fix(miner): reject path-traversal repo segments in the 4 remaining normalizeRepoFullName parsers - #8065
Conversation
…rmalizeRepoFullName parsers repo-clone.ts's isValidRepoSegment rejects a ./../control-char owner or repo segment before it's persisted to SQLite or echoed through a CLI. JSONbored#5831 and JSONbored#7525 rolled it out to ten sibling parsers, but four were missed: contribution-profile-cache.ts, prediction-ledger.ts, replay-snapshot.ts, and run-state.ts still only checked 'exactly one slash, both halves non-empty'. Inputs like 'owner/..', '../repo', or tab/newline segments passed these four while being rejected everywhere else -- and each backs a SQLite key and is echoed through its sibling CLI, the exact rationale JSONbored#5831/JSONbored#7525 used. Call isValidRepoSegment on both owner and repo in all four, matching the exact call shape of the ten already-fixed siblings. Adds a per-file regression test asserting a path-traversal/invalid-character segment throws invalid_repo_full_name, covering both operands, mirroring test/unit/miner-claim-ledger.test.ts. Closes JSONbored#7795
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-22 18:12:44 UTC
Review summary Nits — 2 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (25.00%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #8065 +/- ##
===========================================
- Coverage 91.82% 38.40% -53.42%
===========================================
Files 734 4 -730
Lines 75019 276 -74743
Branches 23037 59 -22978
===========================================
- Hits 68885 106 -68779
+ Misses 5034 170 -4864
+ Partials 1100 0 -1100
Flags with carried forward coverage won't be shown. Click here to find out more.
|
What & why
repo-clone.tsexportsisValidRepoSegment, which rejects a repoownerorreposegment containing./../control-characters/whitespace before it ispersisted to SQLite or echoed back through a sibling CLI. #5831 and #7525 rolled
this guard out across the miner's
normalizeRepoFullNameparsers, but four weremissed and still only checked "exactly one slash, both halves non-empty":
packages/loopover-miner/lib/contribution-profile-cache.tspackages/loopover-miner/lib/prediction-ledger.tspackages/loopover-miner/lib/replay-snapshot.tspackages/loopover-miner/lib/run-state.tsInputs like
owner/..,../repo, or a tab/newline segment passed these fourwhile being rejected by every already-guarded sibling — and each of these four
backs a SQLite key and is echoed through its sibling CLI, the exact rationale
#5831/#7525 cited.
Change
Call
isValidRepoSegmenton both the owner and repo segment in all fourparsers, using the identical call shape as the ten already-fixed siblings
(rename/remove nothing else). Adds a per-file regression test asserting a
path-traversal / invalid-character segment throws
invalid_repo_full_name,covering both operands, mirroring
test/unit/miner-claim-ledger.test.ts.Closes #7795