diff --git a/.github/actions/artifacts_build/action.yml b/.github/actions/artifacts_build/action.yml index 074e1651..84d989a0 100644 --- a/.github/actions/artifacts_build/action.yml +++ b/.github/actions/artifacts_build/action.yml @@ -103,4 +103,5 @@ runs: uses: ./.github/actions/image_scan with: image-ref: ${{ inputs.image_uri_with_tag }} - severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN' \ No newline at end of file + severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN' + logout: 'true' \ No newline at end of file diff --git a/.github/actions/image_scan/action.yml b/.github/actions/image_scan/action.yml index 9d4e4269..6915d49f 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 @@ -30,4 +36,4 @@ runs: with: image-ref: ${{ inputs.image-ref }} severity: ${{ inputs.severity }} - exit-code: '1' \ No newline at end of file + exit-code: '1' diff --git a/.github/workflows/daily-scan.yml b/.github/workflows/daily-scan.yml index d6305471..4eab1fa4 100644 --- a/.github/workflows/daily-scan.yml +++ b/.github/workflows/daily-scan.yml @@ -66,8 +66,18 @@ jobs: - name: Print dependency scan results on failure 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 - # TODO: Update image to public once available - name: Perform high image scan if: always() id: high_scan @@ -75,8 +85,8 @@ jobs: with: image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-node:v0.7.0" severity: 'CRITICAL,HIGH' + logout: 'false' - # TODO: Update image to public once available - name: Perform low image scan if: always() id: low_scan @@ -84,6 +94,7 @@ jobs: with: image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-node:v0.7.0" severity: 'MEDIUM,LOW,UNKNOWN' + logout: 'false' - name: Configure AWS Credentials for emitting metrics if: always()