Skip to content

fix(selfhost): protect private policy surfaces#1405

Merged
JSONbored merged 2 commits into
mainfrom
codex/fix-private-repo-policy-leak
Jun 26, 2026
Merged

fix(selfhost): protect private policy surfaces#1405
JSONbored merged 2 commits into
mainfrom
codex/fix-private-repo-policy-leak

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Prevent container-local private repo policy (GITTENSORY_REPO_CONFIG_DIR) from leaking into contributor-facing outputs such as MCP gittensory_predict_gate, local branch analysis, and public PR advisory/gate comments.

Description

  • Route contributor-facing MCP prediction and local-branch analysis to loadPublicRepoFocusManifest(...) so only the public repo-file manifest is used for those surfaces (keeps private mounted manifests out of public predictions).
  • Redact manifest-derived advisory findings before appending them to public advisory output by introducing publicSafeManifestPolicyFinding(...) and an overrides table that removes exact blocked-path and test-expectation details while preserving enforcement and action text.
  • Add a regression test that installs a container-local manifest via setLocalManifestReader(...) and asserts that gittensory_predict_gate still predicts from the public repo-file snapshot and does not expose private blocked paths or test expectations.

Testing

  • Ran targeted unit tests npx vitest run test/unit/mcp-predict-gate.test.ts test/unit/focus-manifest-loader.test.ts and the focused queue subset (-t "manifest|gittensory_predict_gate"), and those tests passed.
  • Type-check passed via npm run typecheck -- --pretty false and local lint/checks (git diff --check) passed.
  • Attempted full local gate npm run test:ci but it failed due to external/environmental issues (actionlint DNS retries and a Vitest coverage provider error TypeError: jsTokens is not a function) so full CI was not completed here; npm audit --audit-level=moderate also could not complete due to a registry 403.

Codex Task

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 26, 2026
@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.38%. Comparing base (8761078) to head (c2ec70b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1405   +/-   ##
=======================================
  Coverage   95.37%   95.38%           
=======================================
  Files         192      192           
  Lines       20866    20867    +1     
  Branches     7546     7545    -1     
=======================================
+ Hits        19901    19904    +3     
  Misses        383      383           
+ Partials      582      580    -2     
Files with missing lines Coverage Δ
src/mcp/server.ts 95.56% <ø> (ø)
src/queue/processors.ts 88.28% <100.00%> (+0.08%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored self-assigned this Jun 26, 2026
@JSONbored JSONbored added the gittensor:bug Gittensor-scored bug fix - worth 0.5x multiplier. label Jun 26, 2026
Revive #1405: rebased onto current main (resolved the predict_gate test against
the changedPaths work in #1413 — both tests kept), fixed the #1413 test to store
a PUBLIC repo_file manifest now that predict_gate reads public-only config,
inlined publicSafeManifestPolicyFinding with a v8-ignore on the unreachable
no-action arm, exported it, and added a focused unit test asserting the private
blocked-path / test-expectation detail is redacted out of the public advisory.
@JSONbored JSONbored force-pushed the codex/fix-private-repo-policy-leak branch from 138a784 to c2ec70b Compare June 26, 2026 06:01
@JSONbored JSONbored merged commit 43b0d6c into main Jun 26, 2026
18 checks passed
@JSONbored JSONbored deleted the codex/fix-private-repo-policy-leak branch June 26, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark codex gittensor:bug Gittensor-scored bug fix - worth 0.5x multiplier. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant