Skip to content

Commit f8e2f8e

Browse files
committed
ci: scan published webapp image post-publish (OS, summary-only)
1 parent b104087 commit f8e2f8e

3 files changed

Lines changed: 83 additions & 0 deletions

File tree

.github/workflows/publish-webapp.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ on:
1414
type: string
1515
required: false
1616
default: ""
17+
outputs:
18+
version:
19+
description: The published image tag
20+
value: ${{ jobs.publish.outputs.version }}
21+
short_sha:
22+
description: Short commit SHA of the published build
23+
value: ${{ jobs.publish.outputs.short_sha }}
1724
secrets:
1825
SENTRY_AUTH_TOKEN:
1926
required: false

.github/workflows/publish.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,14 @@ jobs:
9696
uses: ./.github/workflows/publish-worker-v4.yml
9797
with:
9898
image_tag: ${{ inputs.image_tag }}
99+
100+
# OS-level CVE scan of the image just published above. Report-only (writes to
101+
# the run summary); runs alongside the worker publishes and never blocks them.
102+
scan-webapp:
103+
needs: [publish-webapp]
104+
permissions:
105+
contents: read
106+
packages: read # pull the just-published image from GHCR
107+
uses: ./.github/workflows/trivy-image-webapp.yml
108+
with:
109+
image-ref: ghcr.io/triggerdotdev/trigger.dev:${{ needs.publish-webapp.outputs.version }}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Trivy Image Scan (webapp)
2+
3+
# OS-level CVE scan of a published webapp image. Called by the publish pipeline
4+
# (publish.yml) to scan each build right after it's pushed to GHCR — so every
5+
# main build and every release is scanned, not rebuilt. Also runnable ad-hoc
6+
# via workflow_dispatch against any image ref.
7+
#
8+
# Report-only: writes a table to the run summary. No SARIF upload, no gate.
9+
# Library/dependency CVEs are covered by Dependabot, so this is restricted to
10+
# OS packages (`vuln-type: os`) to avoid double-reporting.
11+
12+
on:
13+
workflow_call:
14+
inputs:
15+
image-ref:
16+
description: "Full image ref to scan (e.g. ghcr.io/triggerdotdev/trigger.dev:main)"
17+
type: string
18+
required: true
19+
workflow_dispatch:
20+
inputs:
21+
image-ref:
22+
description: "Full image ref to scan"
23+
type: string
24+
required: false
25+
default: "ghcr.io/triggerdotdev/trigger.dev:main"
26+
27+
permissions: {}
28+
29+
concurrency:
30+
group: trivy-image-webapp-${{ inputs.image-ref }}
31+
cancel-in-progress: true
32+
33+
jobs:
34+
scan:
35+
name: Scan
36+
runs-on: ubuntu-latest
37+
permissions:
38+
contents: read
39+
packages: read # pull the image from GHCR
40+
steps:
41+
- name: Run Trivy image scan
42+
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
43+
with:
44+
scan-type: image
45+
image-ref: ${{ inputs.image-ref }}
46+
# vuln-type maps to --pkg-types: OS packages only (library deps are
47+
# Dependabot's job). ignore-unfixed drops vulns with no patch yet.
48+
vuln-type: os
49+
ignore-unfixed: true
50+
severity: HIGH,CRITICAL
51+
format: table
52+
output: trivy-image-webapp.txt
53+
54+
- name: Job summary
55+
if: always()
56+
env:
57+
IMAGE_REF: ${{ inputs.image-ref }}
58+
run: |
59+
{
60+
echo "## Trivy Image Scan (webapp) — \`${IMAGE_REF}\`"
61+
echo '```'
62+
# GitHub step summary is capped at 1 MiB; truncate large reports.
63+
head -c 900000 trivy-image-webapp.txt 2>/dev/null || echo "(no report produced)"
64+
echo '```'
65+
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)