Skip to content

fix(signals): redact /root/ and forward-slash Windows paths in the manifest public-safe guard - #1688

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
jaso0n0818:fix/focus-manifest-root-path-1782666313
Jun 29, 2026
Merged

fix(signals): redact /root/ and forward-slash Windows paths in the manifest public-safe guard#1688
JSONbored merged 2 commits into
JSONbored:mainfrom
jaso0n0818:fix/focus-manifest-root-path-1782666313

Conversation

@jaso0n0818

Copy link
Copy Markdown
Contributor

The bug

isFocusManifestPublicSafe is the public-output safety gate used by contributor-issue drafts (src/services/contributor-issue-draft.ts) and decision packs (src/services/decision-pack.ts). Its local-filesystem-path alternatives have drifted from the canonical PUBLIC_UNSAFE_PATTERN in src/signals/redaction.ts:

Path form redaction.ts (canonical) isFocusManifestPublicSafe
/Users/ /home/ /tmp/ redacted redacted
/root/ redacted leaks
C:/Users/ (forward slash) redacted leaks
C:\Users\ (backslash) redacted redacted

So a manifest string containing /root/<path> — the home/CWD on containers and most CI runners — or the forward-slash Windows form C:/Users/<path> passes as public-safe and leaks a local filesystem path into public output, even though the function's own doc comment says such text "must not leak ... local filesystem path material".

The fix

Sync the path alternatives with the canonical guard: add /root/ and accept both slash forms ([A-Z]:[\\/]Users[\\/]). One-line regex change; the forbidden-term list is untouched.

Tests

The existing public-safe invariant test only covered reward/secret terms, never paths — which is why the drift went unnoticed. Added a regression test asserting /Users/, /home/, /root/, /tmp/, and both Windows forms are rejected, plus a relative-path (src/signals/...) safe case. Full local gate green; codecov patch covers the changed line; OpenAPI unchanged.

No linked issue: a small, self-evident, self-contained security fix to one guard — no behavior change beyond closing the leak, no API/schema/DB change.

…nifest public-safe guard

`isFocusManifestPublicSafe` is the public-output safety gate for
contributor-issue drafts and decision packs (src/services/contributor-issue-draft.ts,
src/services/decision-pack.ts). Its local-filesystem-path alternatives drifted
from the canonical PUBLIC_UNSAFE_PATTERN in src/signals/redaction.ts: it omits
`/root/` and only matches the backslash Windows form (`C:\\Users\\`), not the
forward-slash one (`C:/Users/`).

As a result a manifest string containing `/root/<path>` (the home/CWD in
containers and most CI runners) or `C:/Users/<path>` passes as public-safe and
leaks a local filesystem path into public output, despite the doc comment
stating such text 'must not leak ... local filesystem path material'.

Sync the path alternatives with the canonical guard: add `/root/` and accept
both slash forms (`[A-Z]:[\\/]Users[\\/]`). Adds regression tests covering
/Users//home//root//tmp and both Windows forms, plus a relative-path safe case.

No linked issue: small, self-evident, self-contained security fix to one guard,
no behavior change beyond closing the leak, no API/schema/DB change.
@jaso0n0818
jaso0n0818 requested a review from JSONbored as a code owner June 28, 2026 17:09
@dosubot dosubot Bot added the size:XS label Jun 28, 2026
@loopover-orb

loopover-orb Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review — safe to merge

2 files · 1 AI reviewers · no blockers · readiness 73/100 · CI green · clean

✅ Approved — safe to merge

Review summary
The patch brings isFocusManifestPublicSafe's filesystem-path check back into parity with redaction.ts by rejecting /root/ and both Windows separator styles, and adds regression coverage for the Unix and Windows cases. The regex change is scoped correctly, and the test covers the newly reachable cases plus a safe relative path. The notable remaining risk is that the path pattern is still duplicated, so future drift remains possible.

Signal Result Evidence
Code review ✅ No blockers 1 reviewers, synthesized
Linked issue ✅ No-issue rationale PR body explains why no issue is linked.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Review load ✅ 20/20 Readiness component derived from cached public PR metadata and labels; size label size:XS.
Validation evidence ❌ 5/25 Cached preflight status is hold.
Open PR queue ❌ 3/10 14 open PR(s), 8 likely reviewable, 6 unlinked.
Contributor context ✅ Confirmed Gittensor contributor jaso0n0818; Gittensor profile; 735 PR(s), 7 issue(s).
Gate result ✅ Passing No configured blocker found.
Nits — 3 non-blocking
  • nit: src/signals/focus-manifest.ts:292 still duplicates redaction.ts's filesystem-path alternatives; a shared helper or exported pattern would make this parity enforceable instead of comment-driven.
  • src/signals/focus-manifest.ts:292: extract the filesystem-path unsafe pattern from redaction.ts, or add a shared helper that both guards call, so the two public-output checks cannot drift again.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
Review context
  • Author: jaso0n0818
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 735 PR(s), 7 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Fix blocker.
  • Expect slower review.
  • Refresh registry data or choose a registered active repo.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Review load = cached public PR metadata such as size labels, changed paths, and preflight status.
  • Open PR queue = repo-wide review pressure; it is not a PR quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
Review details

Generated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative.

The patch brings isFocusManifestPublicSafe's filesystem-path check back into parity with redaction.ts by rejecting /root/ and both Windows separator styles, and adds regression coverage for the Unix and Windows cases. The regex change is scoped correctly, and the test covers the newly reachable cases plus a safe relative path. The notable remaining risk is that the path pattern is still duplicated, so future drift remains possible.

Nits (2)

  • nit: src/signals/focus-manifest.ts:292 still duplicates redaction.ts's filesystem-path alternatives; a shared helper or exported pattern would make this parity enforceable instead of comment-driven.
  • src/signals/focus-manifest.ts:292: extract the filesystem-path unsafe pattern from redaction.ts, or add a shared helper that both guards call, so the two public-output checks cannot drift again.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb

loopover-orb Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Important

🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪

🔍 Gittensory is reviewing…

AI analysis is in progress. This comment will update when the review is complete.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing

@loopover-orb loopover-orb Bot added gittensor gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jun 28, 2026
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.58%. Comparing base (8652e6c) to head (c58f8df).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1688   +/-   ##
=======================================
  Coverage   95.58%   95.58%           
=======================================
  Files         204      204           
  Lines       22295    22295           
  Branches     8053     8053           
=======================================
  Hits        21310    21310           
  Misses        408      408           
  Partials      577      577           
Files with missing lines Coverage Δ
src/signals/focus-manifest.ts 99.17% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dosubot dosubot Bot added the lgtm label Jun 29, 2026
@JSONbored
JSONbored merged commit 040aa18 into JSONbored:main Jun 29, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants