Repository navigation
71 lines (61 loc) · 2.31 KB
/
Copy pathimage-scan.yml
File metadata and controls
71 lines (61 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Scan and Generate Grype Report
on:
schedule:
- cron: '0 9 * * *'
permissions: {}
env:
# Mirror targets from helm-charts scripts/sync-images/images.yaml, same as
# release.yml's hardened build. Unset variables fall back to those tags; an
# empty build arg would break FROM.
BUILD_BASE_IMAGE: ${{ vars.TRUEFORGE_NODE_BUILD_BASE_IMAGE || '526077812922.dkr.ecr.us-east-1.amazonaws.com/tfy-internal/node:24-dev' }}
RUNTIME_BASE_IMAGE: ${{ vars.TRUEFORGE_NODE_RUNTIME_BASE_IMAGE || '526077812922.dkr.ecr.us-east-1.amazonaws.com/tfy-internal/node:24' }}
jobs:
upload-grype:
name: Upload Grype results
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
id-token: write
security-events: write
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
# Pull-only credential for the devtest account that helm-charts mirrors
# the hardened bases into. Scanning the public-base image would report a
# different CVE set than the image TrueFoundry SaaS actually runs.
- name: Configure AWS credentials for private ECR
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: ${{ secrets.AWS_DEVTEST_ECR_IAM_ROLE_ARN }}
aws-region: us-east-1
- name: Log in to private Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
with:
registries: '526077812922'
- name: Build hardened image
uses: docker/build-push-action@v7
with:
load: true
file: Dockerfile
context: .
platforms: linux/amd64
provenance: false
tags: trueforge:grype-report
build-args: |
BUILD_BASE_IMAGE=${{ env.BUILD_BASE_IMAGE }}
RUNTIME_BASE_IMAGE=${{ env.RUNTIME_BASE_IMAGE }}
- name: Scan image
id: scan
uses: anchore/scan-action@v7
with:
image: trueforge:grype-report
fail-build: false
output-format: sarif
# Include every severity. fail-build is off, so findings are reported, not gating.
severity-cutoff: negligible
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
category: grype-trueforge