fix: add a Content-Security-Policy meta tag to docusaurus.config.js headTags - #358
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
….config.js headTags The published site shipped no Content-Security-Policy. GitHub Pages cannot set response headers, so a meta http-equiv tag in headTags is the only place this site can express one. This adds base-uri 'self', object-src 'none' and form-action 'self'. These three directives need no script-src allowance, so they cannot constrain Docusaurus hydration, the ld+json block or docusaurus-plugin-search-local. script-src is deliberately omitted: Docusaurus emits inline bootstrap scripts, so it could only ship with 'unsafe-inline' and would add no protection. frame-ancestors is omitted because browsers ignore it when delivered via meta http-equiv. Verified against a full production build: the tag renders on all 46 pages, the ld+json and manifest head tags are unchanged, and the build contains no base, object, embed or form elements for the policy to break. Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "sec-check" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
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.
Security Fix
Adds a
Content-Security-Policymeta tag to the existingheadTagsarray indocusaurus.config.js.Cluster claimed by this PR:
docusaurus.config.js->headTagsonly. No other file is touched. No other open PR modifiesdocusaurus.config.js(#275 addstests/site-config.test.mjsand only asserts that anapplication/ld+jsontag exists, which this change preserves).The published site shipped no policy of any kind. GitHub Pages — the deploy target in
.github/workflows/deploy-gh-pages.yml— cannot set response headers, soheadTagsis the only place this site can express one. That matters becausedocs/architectures/*.mdandstatic/img/architectures/**are regenerated fromgithub.com/cncf/architecture, and severaldata/*.jsonfiles supplyhrefandsrcvalues rendered directly bysrc/components/.What it sets
These three directives require no
script-srcallowance, so they cannot constrain Docusaurus hydration, the theme-switch inline script, theapplication/ld+jsonblock, ordocusaurus-plugin-search-local.What it deliberately does not set
script-src— Docusaurus emits inline bootstrap scripts, so anyscript-srcthis site could actually ship would need'unsafe-inline'. That would provide no XSS protection while creating the false impression that it does.frame-ancestors— browsers ignore it when delivered via a meta tag. Clickjacking needs a real response header and a different hosting arrangement; it is out of scope here and issue [sec-check] Published site ships no Content-Security-Policy: an injected base tag would repoint every relative URL (docusaurus.config.js headTags) #356 says so explicitly.Verification
Ran a full
npm run build:productionon this branch:base-uri 'self'; object-src 'none'; form-action 'self'.application/ld+jsonhead tags are unchanged.base,object,embedandformelements, so no directive in this policy can break existing markup.npx prettier --check docusaurus.config.jspasses.Closes #356
Filed by sec-check agent (ACMM L4/L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=sec-check backend=copilot model=claude-opus-5