Repository navigation
Description
Outcome
Each security-relevant helper has exactly one implementation, in the lowest package every caller can depend on, and every caller uses it. The helpers in question are the subscription-billing credential guard, the public-address (SSRF) and robots.txt guard for outbound fetches, symlink-safe path containment, frontmatter block splitting and the governance-policy file read. A fix to one of them lands once and protects every caller.
Why now
A repository review on 2026-10-22 (main dcf5341aa) found each of these written two to five times, with the copies already disagreeing on edge cases. A missed entry in a billing guard means unexpected API billing. A containment copy that forgets symlinks is a path escape. A splitter that accepts a different closing fence reads a different body than the indexer. This epic closes those findings: #2493, #2502, #2506, #2507, #2508.
Shared context
- Billing guard. Delivered by core: the Claude subscription billing guard is copied into the chat backend under a false comment #2493:
CLEARED_API_CREDENTIALSand the settings refusal now live once inpackages/common/src/claude-subscription.ts:36, imported by core and the Claude backend. - SSRF / robots guard. Delivered by scrape: the private-address guard lives only in module-travel, and the robots.txt fetch is unbounded #2502: the private-address guard that was private to module-travel now lives in
@schlessera/brain-scrape(forbiddenV4,packages/scrape/src/politeness/address.ts:46), replacing travel'sRouteRobotssubclass. - Path containment. Delivered by packages: symlink-safe path containment and the scratch-area rule are implemented separately in core, ui-sdk and ui-server with diverging rules #2506 and packages: inline startsWith containment checks bypass the shared isWithin #3423: shared sync/async resolvers (
resolveContainedSync,packages/common/src/safe-path.ts:237;resolveContained, same file:250) and lexical predicate (isWithin, same file:47). Core, SDK and server retain policy wrappers around these shared mechanisms. packages: inline startsWith containment checks bypass the shared isWithin #3423 replaces the inline containment copies and adds the lint gate (scanSource,scripts/check-inline-containment.ts:95;scanTree, same file:119). PR refactor(packages): route inline startsWith containment checks through isWithin, and lint them #3575 and batch refactor: land epic #2539 batch 1 — one isWithin for every path containment check (#3423) #3576 are verified ancestors of inspected main. - Frontmatter splitting. packages: frontmatter fence detection is hand-written at eight sites that disagree with parseFrontmatter on BOM and end-of-file fences #2507 is closed: fix(core,ui-react): find frontmatter fences through one shared frontmatterBlock (#2507) #3462 supplied the shared splitter and consumer migrations; merged #3649,
4e359a5229a4abf481c2ec4cc78bda81ab22fa0d, completes the policy-review consumer and removes its lint exception. That commit is an ancestor of inspected main. The current policy review usesfrontmatterBlockthrough (split,packages/ui-server/src/brain/policy-proposal.ts:57-63); it no longer has an independent...closer. Shared generated-region, hygiene and UI consumers retain their own behavior-preserving wrappers. Rule 3 inscripts/check-frontmatter-parse.tscovers hand-written package fence detection. The separate deferred input-narrowing question ui-server: reject ambiguous policy frontmatter before approval #3666 does not undo or block the delivered shared-parser outcome. - Governance-policy read. Delivered by ui-server: the policy writer re-implements common's descriptor-anchored governance policy read with different hardening #2508: common owns
openGovernancePolicyAnchored(packages/common/src/governance-policy.ts:300),verifyGovernancePolicyAnchored(same file:332) andcheckGovernancePolicy(same file:340). The policy writer imports those primitives and only maps refusals (REFUSALS,packages/ui-server/src/brain/policy-proposal.ts:19).
Constraints and non-goals
- No new seam. These are concrete helpers in an existing package, not pluggable interfaces (ROADMAP "What binds future work", item 2).
- Dependencies run one way: a helper moves down (into
brain-commonorbrain-scrape), never into a package its callers may not depend on. Any new edge goes throughtests/allowed-edges.ts. - Behaviour is preserved unless a child proves the surviving copy was wrong. Where copies disagree, the child names which rule wins and adds a test that fails on the losing behaviour.
./internalentries ofbrain-commoncarry no public compatibility promise. A public export of a moved helper is a contract change and needs its own ruling.- Out: rewriting the governance-policy format, changing what the billing guard clears, and changing scrape's politeness policy beyond identity and bounds.
Breakdown
All seven native children are closed. The merged-child receipts and complete family/lint audit below govern parent completion; child closure alone is not that audit. Each original family moves its helper and deletes the copies:
- core: the Claude subscription billing guard is copied into the chat backend under a false comment #2493 — billing credential guard into
brain-common(delivered; on main through batch-1 lane PR refactor(common): land epic #2539 batch 1 — hold the Claude subscription billing guard once #3368) - scrape: the private-address guard lives only in module-travel, and the robots.txt fetch is unbounded #2502 — SSRF and robots guard into
brain-scrape, replacing travel'sRouteRobotssubclass (delivered 2026-11-02) - packages: symlink-safe path containment and the scratch-area rule are implemented separately in core, ui-sdk and ui-server with diverging rules #2506 — path containment into
brain-common(delivered by refactor(common): hold symlink-safe path containment once (#2506) #3424; its merge is an ancestor of inspected main) - packages: frontmatter fence detection is hand-written at eight sites that disagree with parseFrontmatter on BOM and end-of-file fences #2507 — one frontmatter block splitter next to
parseFrontmatter(delivered by fix(core,ui-react): find frontmatter fences through one shared frontmatterBlock (#2507) #3462 and fix(ui-server): split the policy review where the parser ends frontmatter (#2507) #3649) - ui-server: the policy writer re-implements common's descriptor-anchored governance policy read with different hardening #2508 — one governance-policy read (delivered by refactor(common): read the governance policy through one descriptor-anchored reader (#2508) #3418; its merge is an ancestor of inspected main)
- core, ui-sdk, ui-server: rule on the containment answers the shared resolver still keeps per caller #3422 — containment-answer ruling (closed; consume its recorded decision rather than reopen it)
- packages: inline startsWith containment checks bypass the shared isWithin #3423 — remaining inline containment checks use shared
isWithin, with a lint gate (delivered by refactor(packages): route inline startsWith containment checks through isWithin, and lint them #3575 / batch refactor: land epic #2539 batch 1 — one isWithin for every path containment check (#3423) #3576)
The five original families are independent and can land in any order. #3422 and #3423 were filed from #2506's work and build on its shared helper.
Definition of done
- For each family, a repo-wide grep (the one named in its child) finds one implementation and no hand copy. Where a copy is cheap to reintroduce (inline
startsWith(root + "/"), a frontmatter fence regex), a lint check refuses it. - Each moved helper has its unit tests in the package that owns it, so
bun run test packages/<owner>catches a regression without a consumer's suite. - Every disagreement between former copies is resolved by a named test, recorded in its child's PR.
Found by a repository review on 2026-10-22.
2026-10-22 triage at main ca8842828ed8634a84c4e8aa4a88e487238721b4: refreshed verified current-source pointers by their named anchors. Scope, recorded decisions and remaining prerequisites are unchanged; source inspection supplies no new runtime or epic-completion evidence.
2026-10-24 continued triage at main dc5d3c73282c29a3f0098306d398743ee18ec791: Verified the still-separate splitter implementations and refreshed the hygiene splitFrontmatter declaration anchor. Existing helper-family ownership, child rulings/behavior-preservation proof and p1/security classification remain; no consolidation or security repair is claimed.
2026-10-25 triage at main ab746a434c4ada11734ffea4e208d1d6211f1aca: Verified moved current-source anchors and refreshed navigation. Historical failed receipts, existing rulings and unresolved prerequisites are unchanged; this is not a new runtime qualification.
2026-10-25 triage at main c670449d3bf1b0639e50ce554d728961f4313add: Verified the moved named current-source anchors and refreshed navigation. Historical evidence keeps its source identity; scope, decisions, native membership and unresolved prerequisites are preserved.
Triage 2026-11-03 (main 3d3516a02): #2493 and #2502 are delivered; their shared-context bullets now point at the single implementations. Attached follow-ups #3422/#3423 are in the breakdown; refreshed the hygiene frontmatter-regex anchor.
2026-11-04 triage at main 53b862123d7b8e4c9d039859fabdc9fc6ad4cd36: Retired stale open-PR and pending-ruling statements using native closure and merged-commit ancestry; #2507 and #3423 remain the open children. No new runtime qualification or implementation is claimed.
Triage 2026-11-08 at main 1619741f291f525d17cde4970a5ada40644117c1: Reconciled all seven closed native children and the final parser-aligned policy-review delivery against merged-commit ancestry and current source. Preserve p1, 0.45.0 and the full family/lint definition of done; no new runtime proof or epic closure is claimed.
Activity
schlessera commentedon Oct 21, 2026
2026-10-22 triage at main
ca8842828ed8634a84c4e8aa4a88e487238721b4: refreshed verified current-source pointers by their named anchors. Scope, recorded decisions and remaining prerequisites are unchanged; source inspection supplies no new runtime or epic-completion evidence.3 remaining items
schlessera commentedon Oct 24, 2026
2026-10-24 triage at main
dc5d3c73282c29a3f0098306d398743ee18ec791: Verified the still-separate splitter implementations and refreshed the hygiene splitFrontmatter declaration anchor. Existing helper-family ownership, child rulings/behavior-preservation proof and p1/security classification remain; no consolidation or security repair is claimed.schlessera commentedon Oct 25, 2026
2026-10-25 triage at main
ab746a434c4ada11734ffea4e208d1d6211f1aca: Verified moved current-source anchors and refreshed navigation. Historical failed receipts, existing rulings and unresolved prerequisites are unchanged; this is not a new runtime qualification.schlessera commentedon Oct 25, 2026
2026-10-25 triage at main
c670449d3bf1b0639e50ce554d728961f4313add: Verified the moved named current-source anchors and refreshed navigation. Historical evidence keeps its source identity; scope, decisions, native membership and unresolved prerequisites are preserved.Merge pull request #3368 from schlessera/epic/2539-security-helpers
schlessera commentedon Nov 3, 2026
Epic state — 2026-11-03
epic/2539-security-helpers: refactor(common): hold symlink-safe path containment once (#2506) #3424 (packages: symlink-safe path containment and the scratch-area rule are implemented separately in core, ui-sdk and ui-server with diverging rules #2506, path containment) and refactor(common): read the governance policy through one descriptor-anchored reader (#2508) #3418 (ui-server: the policy writer re-implements common's descriptor-anchored governance policy read with different hardening #2508, governance-policy read).needs: decision) and packages: inline startsWith containment checks bypass the shared isWithin #3423 (remaining inlinestartsWithchecks plus the lint gate, blocked by packages: symlink-safe path containment and the scratch-area rule are implemented separately in core, ui-sdk and ui-server with diverging rules #2506).The definition of done's lint gate for inline containment now lives in #3423.
Merge pull request #3506 from schlessera/epic/2539-security-helpers
schlessera commentedon Nov 4, 2026
Epic state — 2026-11-04 (inspected main
53b862123d7b8e4c9d039859fabdc9fc6ad4cd36)Delivered on inspected main: #2493, #2502, #2506, #2508 and the #3422 containment-answer ruling. The #3424 and #3418 merge commits are verified ancestors. Remaining open: #2507 (frontmatter splitter) and #3423 (remaining containment callers and lint gate). The body no longer describes those delivered PRs/ruling as pending. No complete security-helper audit or new runtime proof is claimed.
The epic remains outside
agent-ready; work continues through its native children.Merge pull request #3576 from schlessera/epic/2539-security-helpers
schlessera commentedon Nov 5, 2026
Epic state — 2026-11-05 (inspected main
35217d283b849b5ef81700d5d4c2ec7486405d12)#3423 is delivered through #3575 / #3576. Of seven native children, only #2507 remains open; its partial shared-splitter use does not establish the full eight-site and lint-guard acceptance criteria. The brief now points to the consolidated containment and policy-read owners.
This reconciles source and tracker state. It supplies no new runtime qualification, complete-epic proof or release commitment.
Merge pull request #3653 from schlessera/epic/2539-security-helpers
schlessera commentedon Nov 8, 2026
Epic state — 2026-11-08 (main
1619741f291f525d17cde4970a5ada40644117c1)All seven native children are closed. #2507 is completed by #3462 plus merged #3649 (
4e359a5229a4abf481c2ec4cc78bda81ab22fa0d, verified on main). The policy review now uses the shared splitter and is no longer a fence-lint exception. #3666 is a separately deferred accepted-input narrowing decision. The parent remains a closure candidate subject to its full family/lint audit and existing release attribution; this triage supplies no new runtime proof.