Skip to content

fix(auth): scope MCP repository access - #484

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

fix(auth): scope MCP repository access#484
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-github-session-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • MCP tools could be invoked by sessions that had global control-panel roles derived from cached evidence and then read private cached repo/PR data for arbitrary installed repositories without a per-repo authorization check. This exposes sensitive cross-tenant data to maintainers/miners.

Description

  • Add per-session repository-scope checks to the MCP server by introducing requireRepoAccess and loadSessionAccessScope on GittensoryMcp and using loadControlPanelAccessScope to compute a session's scoped repos and account logins, with a short-lived per-instance cache. (src/mcp/server.ts).
  • Enforce requireRepoAccess for MCP repo-scoped tools before loading cached private repo data, including getRepoContext, getBurdenForecast, getIssueQuality, getRepoOutcomePatterns, explainRepoDecision, preflightPr, preflightLocalDiff, previewScore, explainReviewRisk, analyzeLocalBranch, and getBountyAdvisory (all in src/mcp/server.ts).
  • Operator identities still bypass the per-repo check while session identities are restricted to explicit repositoryFullNames or account-owned repos in the access scope; unauthorized sessions now fail early with a forbidden error.
  • Add integration coverage that exercises the change by proving a maintainer session can access its allowed repo via MCP but is rejected when requesting a sibling private repo; test update in test/integration/api.test.ts.

Testing

  • Ran the targeted integration test: NO_COLOR=1 npx vitest run --config vitest.config.ts test/integration/api.test.ts -t "blocks command previews for sibling repos" --reporter verbose, and the test passed (1 test run, others skipped as expected).
  • Ran full TypeScript typecheck with npm run typecheck (tsc --noEmit) which succeeded with no errors.

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 6ccf6a9 Commit Preview URL

Branch Preview URL
Jun 10 2026, 06:04 AM

@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
@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 #484 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
@JSONbored JSONbored self-assigned this Jun 10, 2026
@JSONbored
JSONbored force-pushed the codex/propose-fix-for-github-session-vulnerability branch from 07463be to 9ef69be Compare June 10, 2026 05:56
@superagent-security superagent-security Bot added the pr:flagged PR flagged for review by security analysis. label Jun 10, 2026
@JSONbored
JSONbored force-pushed the codex/propose-fix-for-github-session-vulnerability branch from 9ef69be to 6ccf6a9 Compare June 10, 2026 06:02
@superagent-security

Copy link
Copy Markdown
Contributor

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

1 similar comment
@superagent-security

Copy link
Copy Markdown
Contributor

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

@superagent-security superagent-security Bot removed the pr:flagged PR flagged for review by security analysis. label Jun 10, 2026
@JSONbored
JSONbored merged commit 556520d into main Jun 10, 2026
8 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-github-session-vulnerability branch June 10, 2026 06:05
@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
JSONbored added a commit that referenced this pull request Jul 31, 2026
…ge (#10266)

`escalate-workflow-outage.ts` counted every non-success at the head of a
workflow's run history, so a maintainer retrying a publish by hand escalated
as a standing outage. That is what #10171 was: six consecutive
publish-miner.yml failures, every one a hand `gh workflow run` against main
failing ETARGET on a @loopover/contract version that was not published yet.
The next run after contract landed succeeded with no code change.

Filtering on the run's `event` / `triggering_actor` / `head_branch` cannot
work here, and the header records why so it is not tried again. The reconcile
path in mcp-release-please.yml dispatches a bare `gh workflow run "$workflow"`
under a PAT, so its runs land as `workflow_dispatch` / `main` / the PAT owner
-- the identical triple a laptop produces. Verified against live history:
publish-miner run #484, which the reconcile job's own log shows it dispatched,
is indistinguishable on every one of those fields from the six manual #10171
failures, and `GET /actions/runs/:id` exposes no `inputs` key either.

So provenance is stamped at dispatch instead. `run-name:` is rendered into
`display_title`, which the runs API does return -- the same mechanism
visual-capture-fallback.yml already uses to correlate a dispatch to its PR.
The five publish workflows take a `dispatched_by_automation` input and stamp a
marker into their run name; both dispatch sites pass it; the streak counts only
runs carrying it.

Manual runs are excluded rather than merely not resetting the streak: a run
nobody automated is not evidence about the automated path in either direction.
Non-dispatch triggers still count exactly as before, so selfhost.yml -- the
other caller, and push-triggered -- is unchanged.

Runs already in the history carry no stamp and so read as unattributable. The
publish escalation therefore stays quiet until three stamped automated failures
accumulate; under-alerting briefly is the fail-safe direction and beats
re-creating the false alarm this removes.

check-dispatch-provenance-stamped.ts asserts the lockstep, since both sides of
the marker fail silently: a drifted `run-name:` leaves the escalation reading
every automated run as manual, still green and still "wired" while covering
nothing. It also rejects an unconditional marker, which would stamp a human's
dispatch as automated and restore the original false alarm.

Closes #10234
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