Skip to content

fix(selfhost): log blob-store path-traversal gets distinctly from misses - #6343

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-blob-store-traversal-log-6283
Jul 16, 2026
Merged

fix(selfhost): log blob-store path-traversal gets distinctly from misses#6343
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-blob-store-traversal-log-6283

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Split createFsBlobStore().get() so a pathFor traversal failure is logged as structured selfhost_blob_key_escapes_base_dir before returning null.
  • Ordinary misses stay silent; put() / delete() keep throwing the check unguarded.
  • Regression test asserts a traversal key logs once and a normal miss does not.

Closes #6283

Test plan

  • npx vitest run test/unit/selfhost-blob-store.test.ts (8 pass)
  • CI green (including validate-code)

Made with Cursor

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 16, 2026 02:58
@superagent-security

Copy link
Copy Markdown
Contributor

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

get() still returns null for escaped keys (safe miss for /loopover/shot), but emits a structured warn instead of swallowing pathFor failures like ordinary ENOENT.

Closes JSONbored#6283

Co-authored-by: Cursor <cursoragent@cursor.com>
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 16, 2026
@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-16 03:07:13 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This diff splits the get() path in createFsBlobStore so a pathFor traversal failure is caught, logged as a structured warn event (selfhost_blob_key_escapes_base_dir) with truncated key/message fields, and then returns null, while ordinary misses (readFile ENOENT) stay silent as before. The two-try-block restructuring is correct and minimal, put()/delete() are untouched and still throw unguarded, and the new test explicitly asserts a traversal get logs once with the expected event/key/message shape while a normal miss logs nothing. The change is well-scoped, closes the linked issue, and both branches (traversal vs ordinary miss) are exercised by tests.

Nits — 4 non-blocking
  • src/selfhost/blob-store.ts: console.warn is used directly rather than any existing structured logger the codebase might have elsewhere for selfhost — worth confirming this matches the project's established logging convention for this module.
  • src/selfhost/blob-store.ts: key and message are independently truncated to 200 chars each with no indication of truncation, which could make a boundary-case payload look complete when it isn't — consider appending an ellipsis or a truncated flag.
  • Consider extracting the JSON.stringify warn-log construction into a small helper if similar structured-log patterns appear elsewhere in the selfhost module, to keep the event schema consistent.
  • The comment block above get() is now fairly long; a short one-line summary plus a link to issue fix(selfhost): createFsBlobStore.get() silently swallows a path-traversal security check as an ordinary cache miss #6283 could suffice instead of embedding full rationale in the docstring.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #6283
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 348 registered-repo PR(s), 168 merged, 30 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 348 PR(s), 30 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The diff splits get() so the pathFor traversal-check failure is caught separately and logged via a structured console.warn with a distinct event name before returning null, while genuine ENOENT misses stay silent and put()/delete() remain unguarded as required, and a regression test asserts the distinct logging behavior.

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 348 PR(s), 30 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 88953e8 into JSONbored:main Jul 16, 2026
14 checks passed
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.60%. Comparing base (d4a2c64) to head (4d33a1a).
⚠️ Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
src/selfhost/blob-store.ts 71.42% 0 Missing and 2 partials ⚠️

❌ Your patch status has failed because the patch coverage (71.42%) 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    #6343      +/-   ##
==========================================
- Coverage   95.60%   95.60%   -0.01%     
==========================================
  Files         597      597              
  Lines       47185    47191       +6     
  Branches    15017    15019       +2     
==========================================
+ Hits        45113    45117       +4     
  Misses       1290     1290              
- Partials      782      784       +2     
Flag Coverage Δ
shard-1 43.98% <0.00%> (-0.19%) ⬇️
shard-2 36.80% <0.00%> (+0.27%) ⬆️
shard-3 32.38% <0.00%> (-0.04%) ⬇️
shard-4 34.05% <0.00%> (-0.58%) ⬇️
shard-5 31.55% <0.00%> (-0.04%) ⬇️
shard-6 45.31% <71.42%> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/selfhost/blob-store.ts 90.90% <71.42%> (-9.10%) ⬇️

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

None yet

Development

Successfully merging this pull request may close these issues.

fix(selfhost): createFsBlobStore.get() silently swallows a path-traversal security check as an ordinary cache miss

1 participant