Skip to content

fix(security): bound focus manifest ingestion - #494

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

fix(security): bound focus manifest ingestion#494
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-focus-manifest-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • The public repo focus manifest path previously fetched and JSON.parsed untrusted remote files via response.text() with no byte-size limit, allowing a repo owner or attacker to supply a very large file and cause memory/CPU exhaustion or fail background jobs.
  • Bulk loading runs all fetches in parallel, amplifying the availability impact when a single oversized manifest is served.

Description

  • Add a shared maximum manifest byte cap MAX_FOCUS_MANIFEST_BYTES = 64 * 1024 and reject content exceeding the cap before parsing in parseFocusManifestContent.
  • Replace unbounded response.text() in fetchRepoFocusManifestFile with a readBoundedResponseText helper that checks Content-Length and performs a bounded streaming read that cancels and returns null if the response grows beyond the cap.
  • Limit bulk manifest loads by introducing REPO_FOCUS_MANIFEST_MAX_CONCURRENT_LOADS = 4 and a mapWithConcurrencyLimit helper used by loadRepoFocusManifests to avoid unbounded parallel fetch/parse amplification.
  • Add unit test coverage for the new behaviors: concurrency cap, oversized Content-Length, oversized stream cancellation, and pre-parse oversized-content rejection; update tests to import the new constants/helpers.

Testing

  • Ran npm run typecheck (tsc --noEmit) and fixed a minor type issue; typecheck succeeded.
  • Ran unit tests for the loader: npm test -- --run test/unit/focus-manifest-loader.test.ts and npm test -- --run test/unit/focus-manifest.test.ts test/unit/focus-manifest-loader.test.ts and both passed.
  • Ran full test suite npm test and all tests passed (95 files, 1391 tests passed, 1 skipped).

Codex Task

@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 #494 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
@dosubot dosubot Bot added the size:M label Jun 9, 2026
@github-actions github-actions Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 9, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@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 519e8c1 Commit Preview URL

Branch Preview URL
Jun 10 2026, 06:46 AM

@JSONbored
JSONbored force-pushed the codex/propose-fix-for-focus-manifest-vulnerability branch from 7f2e87d to 519e8c1 Compare June 10, 2026 06:44
@JSONbored
JSONbored merged commit 0122c73 into main Jun 10, 2026
10 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-focus-manifest-vulnerability branch June 10, 2026 06:48
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 10, 2026
@JSONbored JSONbored added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label 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. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant