Unified · Split
| @@ -50,3 +50,15 @@ test("issueMcpApiKey returns null when secret is missing", async () => { · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | expect(apiKey).toBeNull(); |
| 52 | 52 | }); |
| 53 | + | |
| 54 | +test("does not fall back to anonymous private key", async () => { | |
| 55 | + delete process.env.MCP_API_KEY_SECRET; | |
| 56 | + process.env.ANONYMOUS_AUTH_PRIVATE_KEY_PEM = "unused-anonymous-key"; | |
| 57 | + | |
| 58 | + const apiKey = await issueMcpApiKey({ | |
| 59 | + workspaceId: "workspace_no_fallback" as Id<"workspaces">, | |
| 60 | + accountId: "account_no_fallback" as Id<"accounts">, | |
| 61 | + }); | |
| 62 | + | |
| 63 | + expect(apiKey).toBeNull(); | |
| 64 | +}); | |
| @@ -26,11 +26,6 @@ function getConfiguredSecret(): string | null { · 25 unmodified lines | ||
| 26 | 26 | return normalizeSecret(explicit); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | − const anonymousPrivateKey = trimOrNull(process.env.ANONYMOUS_AUTH_PRIVATE_KEY_PEM); | |
| 30 | − if (anonymousPrivateKey) { | |
| 31 | − return normalizeSecret(anonymousPrivateKey); | |
| 32 | − } | |
| 33 | − | |
| 34 | 29 | return null; |
| 35 | 30 | } |
| 36 | 31 | |