feat: per-API-key repo scoping (fail-closed) + auth-boundary & stack-trace diagnosis tests#12
Merged
Merged
Conversation
… (OAuth + API key)
…lers -> impls -> context)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings API-key callers under the same per-repo least-privilege authorization the OAuth path already enforces, then adds the two requested test suites. Previously the per-repo gate in
QueryExecutor.executeQueryfired only foroauthcallers — any valid API key could read every indexed repo (source, symbols, file tree, search). On a shared multi-repo indexer that exposed other teams' sensitive code.repos:allow-list carried onCallerIdentity.allowedRepos, enforced in the existingexecuteQuerychoke point:repos: ["*"]→ full read access (explicit, auditable)repos: [a, b]→ restricted to those reposrepos:omitted → denied all queries (fail-closed) — every key must declare its scopeget_index_health,query_audit_log,verify_audit_chain) require a["*"]key, consistent with OAuth. stdio (local subprocess) stays trusted/unscoped. SCIP upload (separate write path) is unchanged.PermissionBoundaryTest— proves an unentitled remote caller leaks nothing meaningful across 5/4 tools, for both OAuth and scoped API keys; plus allowed-access controls, fail-closed-on-resolver-error, and audit-of-denials. (Closes a real gap: no end-to-end denial test existed.)StackTraceDiagnosisTest— poster-child "paste a stack trace → diagnose" flow: frame →get_symbol_detail(file+method+line) →find_references→find_implementations→get_file_summary→search_code.ApiKeyScopeGateTest— fast unit tests for the gate (allow/deny/wildcard/unscoped/repo-less).CLAUDE.md.Implements the plan in
docs/superpowers/plans/2026-05-30-apikey-repo-scoping-and-boundary-tests.md.Shipping this denies every existing API key until it is given a
repos:scope (the fail-closed contract). Existing keys needrepos: ["*"]or an explicit list added. The un-rotateddev-*tokens are affected.Test Plan
./gradlew test— full unit suite green (incl.ApiKeyScopeGateTest, updatedCallerIdentityTest/ApiKeyAuthenticatorTest/ConfigLoaderTest)./gradlew integrationTestforPermissionBoundaryTest,StackTraceDiagnosisTest,SemanticQueryTest,StreamableHttpTransportIntegrationTest— greenbuildgreen on PR🤖 Generated with Claude Code