Repository navigation
Automate SBOM generation, artifact preservation, and attestation for TheHealthApp - #229
Merged
Merged
Conversation
7 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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 thebuild-outputupload or the Backend Tests job.anchore/sbom-action) scans the builtfrontend/distfolder and writesTheHealthApp-frontend-sbom.spdx.json(SPDX 2.3 JSON).frontend/package-lock.jsonand writesTheHealthApp-frontend-deps-sbom.spdx.json. See the note below for why.actions/upload-artifact@v4as one workflow artifact,TheHealthApp-frontend-sboms, which can be downloaded from the run summary.actions/attest@v4creates signed build provenance for both SBOM files. It runs only on pushes tomainand is skipped on pull requests.gh attestation verifychecks both attestations right after signing, so a bad signature fails the run.id-token: write,attestations: write,artifact-metadata: write). I also addedcontents: 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/distSBOM 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 indist.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, includingreact. 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:TheHealthApp-frontend-sbomsartifact appears under the run summary and contains both SBOMs.react.✓ Verification succeeded!(screenshots below).Because the test ran on my fork, the attestations were signed by
sprabhnoor. After merge, CI onoss-slu/TheHealthAppwill produce attestations that verify with the issue's command:Screenshots