Skip to content

fix(mcp): enforce repo scope for gate prediction - #717

Merged
JSONbored merged 2 commits into
mainfrom
codex/propose-fix-for-repository-access-vulnerability
Jun 14, 2026
Merged

fix(mcp): enforce repo scope for gate prediction#717
JSONbored merged 2 commits into
mainfrom
codex/propose-fix-for-repository-access-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • The gittensory_predict_gate MCP tool enforced contributor self-scope but omitted per-repository authorization, allowing a session to read cached repo-scoped metadata and infer private signals for repos it should not access.

Description

  • Add an explicit repository authorization check by calling await this.requireRepoAccess(repoFullName) in the predictGate handler before loading any repo-scoped cached data.
  • Preserve the existing contributor self-scope check via requireContributorAccess(input.login) so contributor and repo scopes remain independent.
  • Add a regression test is repo-scoped: a session cannot predict against an inaccessible repo to test/unit/mcp-predict-gate.test.ts that asserts a session-scoped user receives a forbidden error when probing a private repo.
  • Modified files: src/mcp/server.ts and test/unit/mcp-predict-gate.test.ts.

Testing

  • Ran unit tests with CI=1 NO_COLOR=1 npm test -- --run test/unit/mcp-predict-gate.test.ts --reporter=verbose and all tests in that suite passed (3/3).
  • Ran static type checks with npm run typecheck (TypeScript tsc --noEmit) and it completed successfully.
  • Verified no diff or linter issues via git diff --check which returned cleanly.

Codex Task

@ghost

ghost commented Jun 14, 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 #717 is no longer open. No action.

💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

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

@ghost ghost added the gittensory:reviewed label Jun 14, 2026
@ghost

ghost commented Jun 14, 2026

Copy link
Copy Markdown

gittensory · advisory review

Reviewed 2 changed file(s) — two independent AI reviewers.

Suggested action:Safe to merge — both reviewers found no blocking issues.

Reviewer A · gpt-oss-120b — recommends ✅ merge
The PR adds a repo‑access check to the MCP gate prediction tool and introduces a test confirming that sessions cannot predict against repositories they lack permission for. The change is minimal, well‑scoped, and improves security.

Suggestions

  • Add a complementary test ensuring that a session can successfully predict for a repository they do have access to, to guard against regressions.
  • Consider adding an inline comment explaining why the repo access check is placed before the parallel data fetches for clarity.

Worth double-checking

  • If requireRepoAccess throws an unexpected error type, the tool may not translate it into the expected isError response; verify error handling aligns with existing patterns.
  • The added await introduces a sequential step before the Promise.all; ensure this does not cause performance regressions in high‑throughput scenarios.

Reviewer B · nemotron-3-120b-a12b — recommends ✅ merge
The PR adds a repository access check in the predictGate MCP tool to enforce that sessions can only predict gates for repositories they have access to. This prevents unauthorized access to private repository data via the gate prediction tool. The change includes a test verifying the behavior for an inaccessible private repo, aligning with the project's public/private boundary invariant.

No blocking issues spotted.

@ghost ghost added the gittensory-review label Jun 14, 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 14, 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 9a8af6b Commit Preview URL

Branch Preview URL
Jun 14 2026, 02:16 PM

@JSONbored
JSONbored merged commit d2c0e74 into main Jun 14, 2026
11 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-repository-access-vulnerability branch June 14, 2026 14:22
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 14, 2026
@github-actions github-actions Bot mentioned this pull request Jun 14, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant