Repository navigation
Conversation
Add `rollup-plugin-sbom` to the Vite build, so every build emits a CycloneDX SBOM of the packages actually shipped to the browser (`/cyclonedx/bom.json` and `/.well-known/sbom`). Build-time dependencies are intentionally left out: they are already covered by the GitHub Dependency Graph via `package-lock.json`. Packages pulled in through Sass (Bulma) are invisible to the bundler, so they are added explicitly in the `afterCollect` hook. The same hook adds the third-party scripts loaded at runtime from their vendors' servers (Osano, Google tag, Google Programmable Search), as unversioned components identified by their exact download URL. The Google scripts are generated per tag/search engine ID, so their URLs are built from the same `VITE_*` variables the website uses, and they are omitted when the ID is not configured (the script is then not loaded). The Google tag is recorded as a dependency of `vue-gtag`, which injects it. Link the SBOM from the "Policies & Cookies" section of the footer. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Add `VITE_LIST_SEARCH_PATH` and `VITE_GOOGLE_SITE_SEARCH_ENGINE_ID`, which are used by the code (and the latter by the SBOM generation) but were missing from the example, and describe each variable. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Closes #4135
This PR adds the generation of a CycloneDX SBOM to the Vite build. The SBOM lists the code actually shipped to the visitor's browser and is published together with the website.
Changes
SBOM generation:
rollup-plugin-sbomcollects the npm packages included in the bundle and writes a CycloneDX 1.7 SBOM to/cyclonedx/bom.jsonand/.well-known/sbom. Build-time dependencies are intentionally left out, since they are already covered by the GitHub Dependency Graph throughpackage-lock.json.Sass packages: Bulma is compiled into the CSS through Sass
@forward, which the bundler never sees. It is added explicitly in the plugin'safterCollecthook.Third-party scripts: the scripts loaded at runtime from their vendors' servers are added as components, since they run with the same privileges as the website:
osano.js(Osano cookie consent), a dependency of the website;gtag.js(Google tag), a dependency ofvue-gtag, which injects it;cse.js(Google Programmable Search), a dependency of the website.These scripts are generated by their vendors for this website and have no version, so they are identified by their exact download URL (a
pkg:genericpurl with adownload_urlqualifier). The Google URLs are built from the sameVITE_GOOGLE_ANALYTICS_PROPERTY_IDandVITE_GOOGLE_SITE_SEARCH_ENGINE_IDvariables used by the website, and a script is omitted when its ID is not configured, since it is not loaded either.Footer link: a "Website SBOM" link is added to the "Policies & Cookies" section of the footer.
.env-EXAMPLE: adds the missingVITE_LIST_SEARCH_PATHandVITE_GOOGLE_SITE_SEARCH_ENGINE_IDvariables and documents each variable.Notes
dist/together with the rest of the website, so the deployment process does not need to change./cyclonedx/bom.jsonand/.well-known/sbomare the defaults ofrollup-plugin-sbom, not a deliberate choice. I have no strong preference: both can be changed through the plugin options (outDir,outFilenameandincludeWellKnown) if you prefer other locations./.well-known/sbomhas no file extension. If the deployment infers content types from extensions, this file should be uploaded asapplication/vnd.cyclonedx+json(orapplication/json). The footer link points to/cyclonedx/bom.json, which is not affected.Error during auto-registration of tool "rollup". This is harmless: the plugin tries to record Rollup in the SBOM metadata, but Vite 8 uses Rolldown instead. The build succeeds and the SBOM is complete.Dependencies
rollup-plugin-sbom4.0.1 (dev dependency, no install scripts).@cyclonedx/cyclonedx-library10.3.0 (dev dependency, same version as used by the plugin, to build the extra components).Testing
npm run build && npm run preview.VITE_GOOGLE_ANALYTICS_PROPERTY_IDandVITE_GOOGLE_SITE_SEARCH_ENGINE_IDin.envbefore building.🤖 Generated with Claude Code