Repository navigation
test: pin CONTENT-SECURITY.md's enumerated rules to the scanners that enforce them - #1327
Merged
Merged
Conversation
… enforce them CONTENT-SECURITY.md is the submitter-facing contract for the two import gates, and it works by enumeration: these elements, these attributes, these URI schemes, these inert MDX tags. Every list is a copy of a constant in scripts/lib/svg-active-content.mjs, scripts/lib/uri-safety.mjs or scripts/lib/mdx-active-content.mjs, and nothing held the copy to the original. It had already drifted. ACTIVE_ELEMENTS gained base and meta in 5dad895, while the document was written earlier in 29fd4d8 and never revisited, so a submitter whose export carried a base element got a CI finding in vocabulary the document did not define. tests/content-security-contract.test.mjs checks each list in both directions and then runs every entry through the scanner it belongs to, so the test is pinned to behaviour rather than to a constant the scanner might have stopped consulting. CONTENT-SECURITY.md gains the two missing elements. Closes #1326 Signed-off-by: quality <quality@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" 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 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.
Test Improvement
CONTENT-SECURITY.mdis the submitter-facing contract for the imported-architecture gates — it is what a contributor is sent to whenvalidate:architecturesorvalidate:architecture-assetsrejects their diagram or page body — and it works by enumeration. Every one of those lists is a copy of a constant inscripts/lib/svg-active-content.mjs,scripts/lib/uri-safety.mjsorscripts/lib/mdx-active-content.mjs, and nothing held the copy to the original.It had already drifted.
ACTIVE_ELEMENTSgainedbaseandmetain 5dad895 (#1245), while the document was written earlier in 29fd4d8 (#1199) and never revisited, so a submitter whose export carried abaseelement got a CI finding (contains a <base> element) in vocabulary the document does not define — against advice that points at a list the element is missing from.tests/content-security-contract.test.mjs(new) pins five enumerations:ACTIVE_ELEMENTS(scripts/lib/svg-active-content.mjs)DOCUMENT_ATTRIBUTES(same file)ACTIVE_SCHEMES(scripts/lib/uri-safety.mjs)ALLOWED_ELEMENTS/ALLOWED_COMPONENT(scripts/lib/mdx-active-content.mjs)package.jsonscriptsEach is checked in both directions — an undocumented rule rejects submissions for a reason nobody can look up; a documented rule that no longer exists tells submitters to avoid something harmless — and every entry is then run through the scanner it belongs to and asserted to actually produce (or, for the allowed sets, not produce) a finding. Parsing the constant alone would catch a renamed entry and not a dead one, so the behavioural leg is what makes the document pinned to the gate rather than to a constant the scanner might have stopped consulting. Negative controls (
<div>,{1 + 1}) keep a list that had swallowed the whole HTML vocabulary from satisfying the allowed-element assertions.CONTENT-SECURITY.mdgains the two missing elements, with the rationale already written in the module's own comment (basere-points every relative reference;metacarries an http-equiv refresh).Verification
TZ=UTC node --test tests/content-security-contract.test.mjs— 13 pass, 0 fail.<meta>from the documented bullet turns the suite red (12 pass / 1 fail), so the pin holds rather than merely reading.npm run test:unit:coverage:checkexits 0; the new file reports 100.00% lines / 100.00% regions, andharness filesstays at 99.57% regions, above the 97% floor.npx prettier --checkclean on both changed files.Scope
Disjoint from the open hold-gated PRs: #1319 (
tests/helpers-script-sandbox*,package.jsonfloors), #1321 and #1323 (CONTRIBUTING.mdparity), #1325 (.npmrc). This PR touches onlyCONTENT-SECURITY.mdand a new test file, and nothing under.github/workflows/.Related Issue
Closes #1326
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88