Skip to content

Automate SBOM generation, artifact preservation, and attestation for TheHealthApp - #229

Merged
mudabs merged 3 commits into
oss-slu:mainfrom
sprabhnoor:main
Oct 28, 2026
Merged

mudabs merged 3 commits into
oss-slu:mainfrom
sprabhnoor:main

Conversation

@sprabhnoor

Copy link
Copy Markdown
Contributor

Automate SBOM generation, artifact preservation, and attestation for TheHealthApp

Closes oss-slu/oss_cybersecurity#49

What was added

All changes are in .github/workflows/ci.yml, inside the existing Build job. The install, lint, test, and build steps did not change, and neither did the build-output upload or the Backend Tests job.

  • Bundle SBOM: Syft (anchore/sbom-action) scans the built frontend/dist folder and writes TheHealthApp-frontend-sbom.spdx.json (SPDX 2.3 JSON).
  • Dependency SBOM: Syft also scans frontend/package-lock.json and writes TheHealthApp-frontend-deps-sbom.spdx.json. See the note below for why.
  • Preservation: both SBOMs are uploaded with actions/upload-artifact@v4 as one workflow artifact, TheHealthApp-frontend-sboms, which can be downloaded from the run summary.
  • Attestation: actions/attest@v4 creates signed build provenance for both SBOM files. It runs only on pushes to main and is skipped on pull requests.
  • In-workflow verification: gh attestation verify checks both attestations right after signing, so a bad signature fails the run.
  • Permissions: added at the Build job level only (id-token: write, attestations: write, artifact-metadata: write). I also added contents: read, because declaring a permissions block sets every unlisted permission to none, and checkout needs read access. Lint, Test, and Backend Tests keep their default permissions.

No credentials or secrets were added. Signing uses GitHub's short-lived OIDC token, and the verify step uses the job's built-in github.token.

Note: why there are two SBOMs

The frontend/dist SBOM is valid but lists 0 packages. Vite bundles React and every other library into minified JS and removes the package metadata Syft reads, so the libraries can't be identified in dist.

Per discussion with my tech lead, I added a second SBOM from frontend/package-lock.json, following the baseline's fallback (§4). It lists ~100 packages with exact versions, including react. Because a lockfile includes everything, it also lists dev and build tools (Vite, ESLint, test tools) that aren't shipped to users.

How it was verified

Tested on my fork, sprabhnoor/TheHealthApp:

  • CI run (all jobs green): https://github.com/sprabhnoor/TheHealthApp/actions/runs/39514497598
  • The TheHealthApp-frontend-sboms artifact appears under the run summary and contains both SBOMs.
  • The dependency SBOM contains ~100 packages, including react.
  • Both SBOMs verified locally:
    gh attestation verify TheHealthApp-frontend-sbom.spdx.json --owner sprabhnoor
    gh attestation verify TheHealthApp-frontend-deps-sbom.spdx.json --owner sprabhnoor
    
    Both returned ✓ Verification succeeded! (screenshots below).

Because the test ran on my fork, the attestations were signed by sprabhnoor. After merge, CI on oss-slu/TheHealthApp will produce attestations that verify with the issue's command:

gh attestation verify ./TheHealthApp-frontend-sbom.spdx.json --owner oss-slu

Screenshots

Screenshot 2026-10-20 at 6 29 26 PM

@mudabs mudabs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@mudabs
mudabs merged commit 3c254a8 into oss-slu:main Oct 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automate SBOM Generation, Artifact Preservation, and Attestation for TheHealthApp

2 participants