5050 mkdir -p sarif/${{ matrix.artifact }}
5151 ./bazel-bin/k8s/${{ matrix.artifact }}/list_image_bundle | xargs -I{} sh -c 'trivy image {} --format=sarif --output=sarif/${{ matrix.artifact }}/$(basename {} | cut -d":" -f1).sarif'
5252
53- # TODO(ddelnano): Remove this check once the operator dependency images are supported. This requires rendering helm templates
54- # and requires some additional work.
53+ # TODO(ddelnano): Remove this check once the operator dependency images are supported.
54+ # This requires rendering helm templates and requires some additional work.
5555 if [ "${{ matrix.artifact }}" = "operator" ]; then
5656 echo "Skipping operator image scan for now."
5757 exit 0
@@ -61,10 +61,11 @@ jobs:
6161 ./scripts/bazel_ignore_codes.sh build \
6262 //k8s/${{ matrix.artifact }}:${{ matrix.artifact }}_image_list
6363
64+ mkdir -p sarif/${{ matrix.artifact }}_deps
6465 # Ignore images whose basename is "/${{ matrix.artifact }}" to avoid scanning the bazel built images (e.g. /vizier-, /cloud-)
65- deps_output_dir=sarif/${{ matrix.artifact }}_deps
66- mkdir -p ${deps_output_dir}
67- cat ./bazel-bin/k8s/${{ matrix.artifact }}/${{ matrix.artifact }}_image_list.txt | grep -v "\/${{ matrix.artifact }}" | xargs -I{} sh -c 'trivy image {} --format=sarif --output=${deps_output_dir} /$(basename {} | cut -d": " -f1).sarif'
66+ # The deps images must have their file named processed differently to avoid conflicts with the image name. For example,
67+ # ory/hydra:v1.9.2-alpine and ory/hydra:v1.9.2-sqlite must not conflict.
68+ cat ./bazel-bin/k8s/${{ matrix.artifact }}/${{ matrix.artifact }}_image_list.txt | grep -v "\/${{ matrix.artifact }}" | xargs -I{} sh -c 'trivy image {} --format=sarif --output=sarif/${{ matrix.artifact }}_deps /$(basename {} | cut -d"@ " -f1 | tr ":" "_" ).sarif'
6869 # yamllint enable rule:line-length
6970 - run : |
7071 # Loop through all ${artifact} and ${artifact}_deps sarif files
7879 - uses : github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
7980 with :
8081 sarif_file : sarif/${{ matrix.artifact }}
81- # TODO(ddelnano): Remove this check once the operator dependency images are supported. This requires rendering helm templates
82- # and requires some additional work.
82+ # TODO(ddelnano): Remove this check once the operator dependency images are supported.
83+ # This requires rendering helm templates and requires some additional work.
8384 - uses : github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
8485 if : ${{ matrix.artifact != 'operator' }}
8586 with :
0 commit comments