Skip to content

fix(mcp): bound predict-gate changedPaths - #1438

Merged
JSONbored merged 1 commit into
mainfrom
codex/fix-unbounded-mcp-changedpaths-vulnerability
Jun 26, 2026
Merged

fix(mcp): bound predict-gate changedPaths#1438
JSONbored merged 1 commit into
mainfrom
codex/fix-unbounded-mcp-changedpaths-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Prevent unbounded caller-controlled path strings in the MCP gittensory_predict_gate input from driving large allocations and CPU during path-glob matching by applying the same per-path metadata size cap used elsewhere.

Description

  • Constrain changedPaths elements in the MCP predictGateShape to PREFLIGHT_LIMITS.changedFileChars (using z.string().min(1).max(PREFLIGHT_LIMITS.changedFileChars)), keeping the existing array cap of 500.
  • Add a regression unit test that submits an oversized changedPaths entry to gittensory_predict_gate and asserts the call is rejected before prediction processing.

Testing

  • Ran the focused unit test file with npx vitest run test/unit/mcp-predict-gate.test.ts, and all tests in that file passed.
  • Ran git diff --check and npm run typecheck and they succeeded (no typing or diff issues).
  • Ran the full local gate with npm run test:ci; the targeted change passed, but the full suite aborted on unrelated long-running coverage remap work with TypeError: jsTokens is not a function and therefore did not complete end-to-end.
  • npm audit --audit-level=moderate could not complete due to a registry audit endpoint error (network/403) in this environment.

Codex Task

@superagent-security

Copy link
Copy Markdown
Contributor

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.39%. Comparing base (a356441) to head (aae81c7).
⚠️ Report is 12 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1438   +/-   ##
=======================================
  Coverage   95.39%   95.39%           
=======================================
  Files         193      193           
  Lines       20929    20929           
  Branches     7564     7564           
=======================================
  Hits        19966    19966           
  Misses        383      383           
  Partials      580      580           
Files with missing lines Coverage Δ
src/mcp/server.ts 95.56% <ø> (ø)
🚀 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 — scores a 0.05x multiplier. label Jun 26, 2026
@JSONbored
JSONbored merged commit 72e9d72 into main Jun 26, 2026
18 checks passed
@JSONbored
JSONbored deleted the codex/fix-unbounded-mcp-changedpaths-vulnerability branch June 26, 2026 20:38
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.

1 participant