Repository navigation
feat: add unwired existing-account MCP actor verification - #1270
Conversation
Pre-merge checks:
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Architecture diagram
sequenceDiagram
participant Caller as Future MCP Handoff Caller
participant Helper as verifyExistingApplicationMcpActor
participant OAuth as verifyOAuthBearer
participant AuthCtx as validateAuthContext
participant ActorGuard as validateProposedRegistrationActor
participant Keys as Account API Keys
participant Privy as Privy Profile/Email Lookup
participant DB as Supabase Storage
Note over Caller,DB: Unwired Existing-Identity Verification Flow
Caller->>Helper: Original NextRequest (Bearer token)
alt Missing/malformed Bearer OR x-api-key present
Helper-->>Caller: 401 Standard Bearer required
else Valid Bearer header
Helper->>OAuth: verifyOAuthBearer(bearer)
alt Delegated OAuth grant valid
OAuth-->>Helper: Grant result
Helper-->>Caller: 403 Delegated authentication unsupported
else OAuth classification fails/undefined
OAuth-->>Helper: null/error
Note over Helper: Disabled runtime import or classification failure
Helper->>AuthCtx: validateAuthContext(allowAccountCreation:false, includeVerificationEvidence:true)
end
end
alt OAuth disabled or undefined
AuthCtx->>Keys: Query account_api_keys
Keys-->>AuthCtx: Key/actor mapping
AuthCtx->>Privy: GET /v1/users/{subject}
Privy->>DB: Fetch account_emails
DB-->>Privy: Profile + linked accounts
Privy-->>AuthCtx: Existing account identity
end
AuthCtx->>ActorGuard: validateProposedRegistrationActor(auth)
alt Actor guard passes
ActorGuard-->>Helper: {actor, workspace}
Helper->>Helper: structuredClone(verificationEvidence)
Helper-->>Caller: {actor, workspace, verificationEvidence}
else Actor guard rejects
ActorGuard-->>Helper: NextResponse error
Helper-->>Caller: Authenticated error (401/403)
end
alt Unexpected runtime/store failure
Helper-->>Caller: 503 Verified identity unavailable
end
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Problem and result
App2104 needs original-actor identity evidence without onboarding an unknown Privy account. Existing MCP authentication can provision before tool dispatch. This adds an unwired, standard-Bearer helper that independently verifies the original server request with fixed existing-account options and reuses the strict application actor guard. Valid delegated OAuth and classification failures deny before standard verification; only copied internal actor/workspace/evidence is returned, never credentials.
No route, tool registration, allowlist, shared auth leaf or Sites create/read/storage implementation changes. Current MCP onboarding remains unchanged. A future trusted request handoff must run before legacy authentication and receives a separate review; this helper is not an execution grant or public result.
Controlled validation
The real OAuth classifier/authentication/actor guard run with controlled runtime, SDK and DB leaves. Sixteen new cases cover disabled runtime import traps, full/limited denial, undefined independent verification, runtime/store failures, existing/unknown Privy identity, exact profile predicates, headers/body spoofing, fresh observations and secret-free output. All 61 tests pass: 16 new plus 45 existing harness compatibility tests. Parent loader/env and dotenv poison isolation and separate child-env filtering pass with owned-process cleanup. Scoped TypeScript, changed-file lint/format and diff whitespace pass. Independent exact-commit Spec 0 / Standards 0.
The shared runner/setup/network/config/golden remain byte-identical. CI launch now uses absolute Node under env-i; source bindings change only the Vercel hash for the new false branch deployment guard. No real credentials, authenticated clients or network/provider effects used.
Boundaries
No personal enrollment, entitlement, SQL atomic revocation, provider cryptographic OAuth proof, client acceptance or runtime availability is claimed. Branch deployments disabled; coordinator retains the merge gate. No policy or storage activation.
Final revision qualification
Head
dddf29749401a687bde71ae5b8f4f0f93492463a, tree1f7842339fe78bfcab528f560a6731f6a6a1780d. All eight Actions jobs pass, including required test/format/lint. The Node 22.23.4 dedicated job checks out this exact head and passes all 61 controlled tests with verified bindings and cleanup. Unit Tests actually checks out synthetic merge7196ea9f4b5ecfacb34c53ae352da4dac2e2a054, whose tree matches this candidate; all workflow and type-check steps pass.Independent exact-successor Spec and Standards reviews: zero findings. Four original Cubic findings fixed; raw exception logging rejected to preserve the credential boundary. The successor file-length suggestion is dispositioned as nonblocking; all six threads are resolved. Cubic completed successfully with that style finding; CodeRabbit skipped review. Codex's no-findings review applies to the earlier
32728ferevision, not the successor.Source-only qualification. No merge, deployment activation, authenticated client acceptance or runtime wiring is included.