-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
chore: harden webapp docker image #3845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+104
−11
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
02ea05c
chore(docker): bookworm-slim base + apt upgrade on build
nicktrn 170bafb
chore(emails): move react-email CLI to devDependencies
nicktrn 5d8c2e2
ci: scan published webapp image post-publish (OS, summary-only)
nicktrn 4b9b996
chore(docker): bump goose v3.26.0->v3.27.1, builder go 1.23->1.26
nicktrn 93199f2
ci: log in to GHCR before image scan for private-image support
nicktrn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Trivy Image Scan (webapp) | ||
|
|
||
| # OS-level CVE scan of a published webapp image. Called by the publish pipeline | ||
| # (publish.yml) to scan each build right after it's pushed to GHCR — so every | ||
| # main build and every release is scanned, not rebuilt. Also runnable ad-hoc | ||
| # via workflow_dispatch against any image ref. | ||
| # | ||
| # Report-only: writes a table to the run summary. No SARIF upload, no gate. | ||
| # Library/dependency CVEs are covered by Dependabot, so this is restricted to | ||
| # OS packages (`vuln-type: os`) to avoid double-reporting. | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| image-ref: | ||
| description: "Full image ref to scan (e.g. ghcr.io/triggerdotdev/trigger.dev:main)" | ||
| type: string | ||
| required: true | ||
| workflow_dispatch: | ||
| inputs: | ||
| image-ref: | ||
| description: "Full image ref to scan" | ||
| type: string | ||
| required: false | ||
| default: "ghcr.io/triggerdotdev/trigger.dev:main" | ||
|
|
||
| permissions: {} | ||
|
|
||
| concurrency: | ||
| group: trivy-image-webapp-${{ inputs.image-ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| scan: | ||
| name: Scan | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: read # pull the image from GHCR | ||
| steps: | ||
| # Authenticate to GHCR so the scan also works for private images | ||
| # (GITHUB_TOKEN isn't forwarded to Docker automatically). Harmless for | ||
| # public images. Pairs with the packages: read permission above. | ||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.repository_owner }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Run Trivy image scan | ||
| uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0 | ||
| with: | ||
| scan-type: image | ||
| image-ref: ${{ inputs.image-ref }} | ||
| # vuln-type maps to --pkg-types: OS packages only (library deps are | ||
| # Dependabot's job). ignore-unfixed drops vulns with no patch yet. | ||
| vuln-type: os | ||
| ignore-unfixed: true | ||
| severity: HIGH,CRITICAL | ||
| format: table | ||
| output: trivy-image-webapp.txt | ||
|
|
||
| - name: Job summary | ||
| if: always() | ||
| env: | ||
| IMAGE_REF: ${{ inputs.image-ref }} | ||
| run: | | ||
| { | ||
| echo "## Trivy Image Scan (webapp) — \`${IMAGE_REF}\`" | ||
| echo '```' | ||
| # GitHub step summary is capped at 1 MiB; truncate large reports. | ||
| head -c 900000 trivy-image-webapp.txt 2>/dev/null || echo "(no report produced)" | ||
| echo '```' | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.