Implement Redis namespace isolation for auth and MCP keys

This commit is contained in:
Basil Hosmer 2025-09-15 02:33:59 -04:00
commit 34fe20efc4
No known key found for this signature in database

View file

@ -124,8 +124,8 @@ describe("auth utils", () => {
// instead of using exchangeToken which changes the value
await saveTokenExchange(authCode, tokenExchange);
// Get the key used by saveTokenExchange
const key = "exch:" + crypto.createHash("sha256").update(authCode).digest("hex");
// Get the key used by saveTokenExchange (now with auth: prefix)
const key = "auth:exch:" + crypto.createHash("sha256").update(authCode).digest("hex");
// Get the encrypted data
const encryptedData = await mockRedis.get(key);
@ -266,8 +266,8 @@ describe("auth utils", () => {
await revokeMcpInstallation(accessToken);
// Should have called getDel with the correct key
expect(getDel).toHaveBeenCalledWith(expect.stringContaining("mcp:"));
// Should have called getDel with the correct key (now auth:installation:)
expect(getDel).toHaveBeenCalledWith(expect.stringContaining("auth:installation:"));
});