Repository navigation
fix(security): name manifest-src in the meta CSP so a manifest cannot load off-origin - #1289
Merged
Merged
Conversation
… load off-origin
The meta Content-Security-Policy deliberately ships no default-src, so every
fetch directive it does not name is absent rather than inherited, and the
browser allows any host. manifest-src was the last such directive: CSP3 6.8.2
gives its fallback chain as << manifest-src, default-src >> and nothing else.
(worker-src is also unnamed but is not a gap -- its chain passes through
script-src, which is already set to 'self'.)
A <link rel="manifest"> naming a third-party host would therefore be fetched,
handing that host the visitor's IP, User-Agent and Referer; a manifest also
carries name, icons, start_url and scope, so an off-origin one misrepresents
the site's installed-app identity.
The only manifest this site links is its own root-relative
${baseUrl}manifest.json, served from static/, so 'self' constrains nothing the
site actually does -- the same premise that made font-src 'self' safe to set.
A new test asserts that premise rather than assuming it, and the directive is
pinned in both the no-fallback directive test and the preview-origin test.
Signed-off-by: sec-check <sec-check@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 keep the |
This was referenced Oct 10, 2026
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
The meta Content-Security-Policy in
docusaurus.config.jsdeliberately shipsno
default-src—tests/site-config.test.mjsassertsdirectives.has('default-src') === false. That means every fetch directive thepolicy does not name is simply absent, and an absent directive restricts
nothing.
manifest-srcwas the last fetch directive left in that state. Per CSP Level 3§6.8.2 ("Get fetch directive fallback list") its chain is literally:
and nothing else.
worker-srcis also unnamed but is not a gap, because itschain is
<< "worker-src", "child-src", "script-src", "default-src" >>andscript-src 'self'is already set.So a
<link rel="manifest" href="https://attacker.example/m.json">that reacheda page would be fetched, handing that host the visitor's IP, User-Agent and
Referer. A manifest also carries
name,icons,start_urlandscope, soan off-origin one misrepresents the site's installed-app identity to anyone who
installs it. This is defence-in-depth of the same class and severity as the
font-srcgap closed in #1284 — the parser gates remain the primary control(CONTENT-SECURITY.md:52).
What changed
docusaurus.config.js— adds"manifest-src 'self'"to the directive list,with a comment recording the CSP3 fallback chain and why
worker-srcis nota sibling gap.
tests/site-config.test.mjs— three additions:manifest-srcin the existing"names the fetch directives that have no default-src fallback" test;
asserts the premise the directive rests on rather than assuming it,
using
remoteTarget()— the same classifier the SVG, MDX and stylesheetgates use — exactly as the
font-srcchange asserted its premise with aCSS scan.
'self'constrains nothing the site actually does: the only manifest linked isthe root-relative
${baseUrl}manifest.jsonemitted atdocusaurus.config.js:153-156and served from
static/manifest.json.Verification
node --test tests/site-config.test.mjs→ 29/29 pass."manifest-src 'self'"from the config makes 2 tests fail(the no-fallback test and the preview-origin test), so the pins are not vacuous.
npx prettier --check docusaurus.config.js tests/site-config.test.mjs→ clean.npm run test:unitcannot run in this sandbox:@swc/corefailswith
Cannot find module './swc.linux-x64-gnu.node'(optional native bindingnot installed here). Confirmed pre-existing — it reproduces identically
with this branch's changes stashed, and neither file in this diff can affect
native binding resolution. CI installs the binding normally.
Closes #1288
Closes #1285 (same finding, filed by the scanner the same day; its optional
worker-srcsuggestion is covered by the fallback-chain note above)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 copilot=1.0.88