Add a report-only vulnerability scan for sandbox images in CI

Aperta
#461 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
57/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, github-actions
Ambito
ci-cd, security

Direzione di ricerca

Start with .github/workflows/build-images.yml and images/docker-bake.hcl to understand how the PR image build runs and how its Bake targets are configured. The issue proposes loading built images into local Docker and scanning them with Grype; check the workflow's runner disk capacity for the universal image. Done means a report appears in $GITHUB_STEP_SUMMARY while the scan remains report-only and published image configuration is unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

The vercel/sandbox/* images are the base for every sandbox, but CI doesn't
check them for known vulnerabilities (CVEs). I'd like to add a report-only
scan to the PR image build, and I'm happy to work on it.

Current behaviour

  • .github/workflows/build-images.yml runs on PRs that touch images/**.
    It builds each image with push: false and only checks that the build
    succeeds. Nothing checks the packages inside the image.
  • images/docker-bake.hcl (_common target) builds every image with:
    attest = [
      "type=provenance,disabled=true",
      "type=sbom,disabled=true"
    ]
    
    So no SBOM is generated either.

Packages with known CVEs can therefore ship in published images without
anyone noticing. The universal image has the largest attack surface,
since it bundles Node.js, Bun, Python and coding agents.

Proposal

Add a Grype scan step to the images job in build-images.yml:

  1. Build as today, but load the image into the runner's local Docker
    (set: *.output=type=docker, CI only) so it can be scanned.
  2. Scan it with anchore/scan-action.
  3. Write the results to the job summary ($GITHUB_STEP_SUMMARY).
Limits the change keeps to
  • Report-only: fail-build: false, so it never blocks a merge.
  • Low noise: only-fixed: true, so it only reports CVEs that have a fixed version.
  • Published images unchanged: docker-bake.hcl and publish-images.yml
    are not touched; the override only applies to the PR build.
  • No new permissions: the workflow stays contents: read (results go to
    the job summary rather than code scanning, which would need
    security-events: write).
  • Pinned to a commit SHA rather than a version tag. I'm proposing
    Grype over trivy-action because of the March 2026 trivy-action tag
    compromise (CVE-2026-33634).

Questions for maintainers

  1. Were SBOM/provenance attestations disabled on purpose (for example for
    VCR or microVM image compatibility)? If so, I'll leave them as they are.
  2. Would you prefer the scan in build-images.yml (PRs), in
    publish-images.yml (published images), or both?
  3. Should it stay report-only, or would you like it to fail on CRITICAL
    CVEs once the backlog is known?

Next steps

I have a draft ready and will test it on my fork first, including whether
loading the large universal image fits in the runner's disk space. Once
you're happy with the approach, I'll open a PR linked to this issue with
the test run.

Lingua principale
TypeScript
Stelle
227
Fork
53
Merge medio
2g 8h
PR unite (30g)
38

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel/sandbox

Tutte le issue di vercel/sandbox

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.