Skip to content

fix(mcp): preserve HTTP status for non-JSON errors - #489

Merged
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-stale-cache-vulnerability
Jun 10, 2026
Merged

fix(mcp): preserve HTTP status for non-JSON errors#489
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-stale-cache-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Prevent non-JSON HTTP authorization/failure responses from being converted into statusless parse errors that enable stale private decision-pack fallbacks.

Description

  • Update apiFetch to parse response text inside a try/catch and, on parse failure for non-OK responses, attach a sanitized payload ({ error: "non_json_response", body: ... }) while preserving response.status so error objects keep the HTTP status.
  • Ensure apiFetch still throws an Error with error.status set when response.ok is false so authorization failures remain ineligible for cache fallback.
  • Add a regression test does not use stale decision-pack cache for non-JSON authorization failures to test/unit/mcp-cli.test.ts that seeds the cache and verifies non-JSON 403 responses from both decision-pack and repo-decision endpoints reject instead of returning cached data.
  • Extend the test fixture server to simulate non-JSON error bodies and content types for decision-pack and repo-decision endpoints.

Testing

  • Ran the unit tests with npm run test:unit -- test/unit/mcp-cli.test.ts and the test suite passed (all tests OK, including the new regression test).
  • Ran the build check with npm run build:mcp and it completed successfully.

Codex Task

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui ee1fd6e Commit Preview URL

Branch Preview URL
Jun 10 2026, 06:23 AM

@github-actions github-actions Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 9, 2026
@ghost

ghost commented Jun 9, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #489 is no longer open. No action.

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

@ghost ghost added the gittensory:reviewed label Jun 9, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@JSONbored
JSONbored force-pushed the codex/propose-fix-for-stale-cache-vulnerability branch from 14dec79 to ee1fd6e Compare June 10, 2026 06:21
@JSONbored
JSONbored merged commit 5e8c757 into main Jun 10, 2026
10 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-stale-cache-vulnerability branch June 10, 2026 06:24
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 10, 2026
@github-actions github-actions Bot mentioned this pull request Jun 10, 2026
12 tasks
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.

1 participant