diff --git a/.github/actions/image_scan/action.yml b/.github/actions/image_scan/action.yml index eb19f78609..7a98a5906a 100644 --- a/.github/actions/image_scan/action.yml +++ b/.github/actions/image_scan/action.yml @@ -11,6 +11,11 @@ inputs: severity: required: true description: "List of severities that will cause a failure" + logout: + required: true + description: | + Whether to logout of public AWS ECR. Set to 'true' for PR workflows to avoid potential call failures, + 'false' for daily scans which has a higher bar for passing regularly and specifically wants to sign in. runs: using: "composite" @@ -22,6 +27,7 @@ runs: # ensure we can make unauthenticated call. This is important for making the pr_build workflow run on # PRs created from forked repos. - name: Logout of public AWS ECR + if: inputs.logout == 'true' shell: bash run: docker logout public.ecr.aws diff --git a/.github/workflows/owasp.yml b/.github/workflows/owasp.yml index f0e7078959..f0297648c1 100644 --- a/.github/workflows/owasp.yml +++ b/.github/workflows/owasp.yml @@ -78,6 +78,17 @@ jobs: if: ${{ steps.dep_scan.outcome != 'success' }} run: less dependency-check-report.html + - name: Configure AWS credentials for image scan + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} + aws-region: ${{ env.AWS_DEFAULT_REGION }} + + - name: Login to Public ECR + uses: docker/login-action@v3 + with: + registry: public.ecr.aws + - name: Perform high image scan on v1 if: always() id: high_scan_v1 @@ -85,6 +96,7 @@ jobs: with: image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v1.33.0" severity: 'CRITICAL,HIGH' + logout: 'false' - name: Perform low image scan on v1 if: always() @@ -93,6 +105,7 @@ jobs: with: image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v1.33.0" severity: 'MEDIUM,LOW,UNKNOWN' + logout: 'false' - name: Perform high image scan on v2 if: always() @@ -101,6 +114,7 @@ jobs: with: image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.2" severity: 'CRITICAL,HIGH' + logout: 'false' - name: Perform low image scan on v2 if: always() @@ -109,6 +123,7 @@ jobs: with: image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.2" severity: 'MEDIUM,LOW,UNKNOWN' + logout: 'false' - name: Configure AWS Credentials for emitting metrics if: always() diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 85215e88e1..f068d52b6c 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -147,6 +147,7 @@ jobs: with: image-ref: ${{ env.TEST_TAG }} severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN' + logout: 'true' - name: Test docker image if: ${{ matrix.os == 'ubuntu-latest' }}