diff --git a/packages/server/lib/controllers/auth/postApiKey.ts b/packages/server/lib/controllers/auth/postApiKey.ts index 8be767f0740..a35382cf0b2 100644 --- a/packages/server/lib/controllers/auth/postApiKey.ts +++ b/packages/server/lib/controllers/auth/postApiKey.ts @@ -21,7 +21,7 @@ import { hmacCheck } from '../../utils/hmac.js'; import { connectionCreated as connectionCreatedHook, connectionCreationFailed as connectionCreationFailedHook, connectionTest } from '../../hooks/hooks.js'; import { connectionCredential, connectionIdSchema, providerConfigKeySchema } from '../../helpers/validation.js'; import db from '@nangohq/database'; -import { isIntegrationAllowed } from '../../utils/auth.js'; +import { errorRestrictConnectionId, isIntegrationAllowed } from '../../utils/auth.js'; const bodyValidation = z .object({ @@ -76,10 +76,10 @@ export const postPublicApiKeyAuthorization = asyncWrapper { }); }); - it.skip('should not be allowed to pass a connection_id with session token', async () => { + it('should not be allowed to pass a connection_id with session token', async () => { const env = await seeders.createEnvironmentSeed(); const config = await seeders.createConfigSeed(env, 'unauthenticated', 'unauthenticated'); diff --git a/packages/server/lib/controllers/auth/postUnauthenticated.ts b/packages/server/lib/controllers/auth/postUnauthenticated.ts index c2f0022f9ff..d193f53c509 100644 --- a/packages/server/lib/controllers/auth/postUnauthenticated.ts +++ b/packages/server/lib/controllers/auth/postUnauthenticated.ts @@ -10,7 +10,7 @@ import type { LogContext } from '@nangohq/logs'; import { hmacCheck } from '../../utils/hmac.js'; import { connectionCreated, connectionCreationFailed } from '../../hooks/hooks.js'; import db from '@nangohq/database'; -import { isIntegrationAllowed } from '../../utils/auth.js'; +import { errorRestrictConnectionId, isIntegrationAllowed } from '../../utils/auth.js'; const queryStringValidation = z .object({ @@ -51,10 +51,10 @@ export const postPublicUnauthenticated = asyncWrapper>, _next: NextFunction) { @@ -65,10 +65,10 @@ class OAuthController { let userScope = req.query['user_scope'] as string | undefined; const isConnectSession = res.locals['authType'] === 'connectSession'; - // if (isConnectSession && receivedConnectionId) { - // errorRestrictConnectionId(res); - // return; - // } + if (isConnectSession && receivedConnectionId) { + errorRestrictConnectionId(res); + return; + } let logCtx: LogContext | undefined; @@ -309,10 +309,10 @@ class OAuthController { const { client_id, client_secret }: Record = body; - // if (isConnectSession && receivedConnectionId) { - // errorRestrictConnectionId(res); - // return; - // } + if (isConnectSession && receivedConnectionId) { + errorRestrictConnectionId(res); + return; + } let logCtx: LogContext | undefined;