test(auth): verify org-less API key rejection on OAuth token routes#3039
Open
0xcucumbersalad wants to merge 1 commit intodecocms:mainfrom
Open
test(auth): verify org-less API key rejection on OAuth token routes#30390xcucumbersalad wants to merge 1 commit intodecocms:mainfrom
0xcucumbersalad wants to merge 1 commit intodecocms:mainfrom
Conversation
…outes Verifies that POST, DELETE, and GET status endpoints return 403 when the request lacks organization context (e.g., org-less API keys), preventing cross-tenant OAuth token injection (AUTHZ-VULN-08). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
Release OptionsSuggested: Patch ( React with an emoji to override the release type:
Current version:
|
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/mesh/src/api/routes/downstream-token.test.ts">
<violation number="1" location="apps/mesh/src/api/routes/downstream-token.test.ts:118">
P2: The new regression tests never assert `findById` is not called, so they don’t verify the intended “reject before lookup” security behavior.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| auth: { user: { id: "user_1" }, apiKey: { userId: "user_1" } }, | ||
| storage: { | ||
| connections: { | ||
| findById: mock(async () => ({ id: "conn_1" })), |
Contributor
There was a problem hiding this comment.
P2: The new regression tests never assert findById is not called, so they don’t verify the intended “reject before lookup” security behavior.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/api/routes/downstream-token.test.ts, line 118:
<comment>The new regression tests never assert `findById` is not called, so they don’t verify the intended “reject before lookup” security behavior.</comment>
<file context>
@@ -105,4 +105,62 @@ describe("Downstream Token Routes", () => {
+ auth: { user: { id: "user_1" }, apiKey: { userId: "user_1" } },
+ storage: {
+ connections: {
+ findById: mock(async () => ({ id: "conn_1" })),
+ },
+ },
</file 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
organization: undefined(simulating an org-less API key) are rejected with 403 beforefindByIdis ever calledTest plan
bun test apps/mesh/src/api/routes/downstream-token.test.ts— 6/6 pass (3 existing + 3 new)bun run lint— passesbun run fmt— passes🤖 Generated with Claude Code
Summary by cubic
Add regression tests to ensure org-less API keys are rejected (403) across all OAuth token routes (POST, DELETE, GET status). Confirms the org-context guard for AUTHZ-VULN-08 and prevents cross-tenant OAuth token injection.
Written for commit 169a2ca. Summary will update on new commits.