Skip to content

Commit f5544c7

Browse files
authored
fix: install grype with checksum verification for container scan reports (#180)
1 parent 7ac76bc commit f5544c7

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

.github/workflows/container-scan.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
grype:
1212
name: Container Scan
1313
runs-on: ubuntu-latest
14+
env:
15+
GRYPE_VERSION: "0.111.0"
1416
steps:
1517
- name: Checkout
1618
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
@@ -20,6 +22,7 @@ jobs:
2022
id: scan
2123
with:
2224
image: ghcr.io/coopernetes/git-proxy-java:latest
25+
grype-version: ${{ env.GRYPE_VERSION }}
2326
fail-build: true
2427
severity-cutoff: high
2528
only-fixed: true
@@ -30,6 +33,16 @@ jobs:
3033
# in the GitHub Security tab (high CVSS score ≠ high actual risk for this workload).
3134
# The build still fails on high/critical with a fix available via fail-build: true above.
3235

36+
- name: Install grype
37+
if: always()
38+
run: |
39+
curl -sSfL -o /tmp/grype.tar.gz \
40+
https://github.com/anchore/grype/releases/download/v${GRYPE_VERSION}/grype_${GRYPE_VERSION}_linux_amd64.tar.gz
41+
curl -sSfL -o /tmp/grype_checksums.txt \
42+
https://github.com/anchore/grype/releases/download/v${GRYPE_VERSION}/grype_${GRYPE_VERSION}_checksums.txt
43+
grep "grype_${GRYPE_VERSION}_linux_amd64.tar.gz" /tmp/grype_checksums.txt | sha256sum --check --ignore-missing
44+
tar -xzf /tmp/grype.tar.gz -C /usr/local/bin grype
45+
3346
- name: Generate human-readable report
3447
if: always()
3548
run: |

.github/workflows/docker-publish.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ jobs:
8686
contents: read
8787
security-events: write
8888
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
89+
env:
90+
GRYPE_VERSION: "0.111.0"
8991
steps:
9092
- name: Checkout
9193
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
@@ -95,6 +97,7 @@ jobs:
9597
id: scan
9698
with:
9799
image: ghcr.io/${{ github.repository }}@${{ needs.build-and-push.outputs.digest }}
100+
grype-version: ${{ env.GRYPE_VERSION }}
98101
fail-build: true
99102
severity-cutoff: high
100103
only-fixed: true
@@ -105,6 +108,16 @@ jobs:
105108
# in the GitHub Security tab (high CVSS score ≠ high actual risk for this workload).
106109
# The build still fails on high/critical with a fix available via fail-build: true above.
107110

111+
- name: Install grype
112+
if: always()
113+
run: |
114+
curl -sSfL -o /tmp/grype.tar.gz \
115+
https://github.com/anchore/grype/releases/download/v${GRYPE_VERSION}/grype_${GRYPE_VERSION}_linux_amd64.tar.gz
116+
curl -sSfL -o /tmp/grype_checksums.txt \
117+
https://github.com/anchore/grype/releases/download/v${GRYPE_VERSION}/grype_${GRYPE_VERSION}_checksums.txt
118+
grep "grype_${GRYPE_VERSION}_linux_amd64.tar.gz" /tmp/grype_checksums.txt | sha256sum --check --ignore-missing
119+
tar -xzf /tmp/grype.tar.gz -C /usr/local/bin grype
120+
108121
- name: Generate human-readable report
109122
if: always()
110123
run: |

0 commit comments

Comments
 (0)