Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix test and rate limiting
Thiago Araujo da Silva26e0f4175a34
diff --git a/backend/e2e-test/routes/v3/auth-signup-sso-enforced.spec.ts b/backend/e2e-test/routes/v3/auth-signup-sso-enforced.spec.tsindex c7b668c342..5f90f580e0 100644--- a/backend/e2e-test/routes/v3/auth-signup-sso-enforced.spec.ts+++ b/backend/e2e-test/routes/v3/auth-signup-sso-enforced.spec.ts@@ -8,6 +8,7 @@ import { ProviderAuthResult } from "@app/services/auth/auth-type";import { TTestSmtpService } from "../../mocks/smtp";import { cleanupEmailDomains, seedVerifiedEmailDomain } from "../../testUtils/email-domains";+import { cleanupSamlConfig, seedSamlConfig } from "../../testUtils/saml-config";const getDb = () => (globalThis as unknown as { testDb: Knex }).testDb;const smtp = () => (globalThis as unknown as { testSmtp: TTestSmtpService }).testSmtp;@@ -22,6 +23,8 @@ describe("Auth SSO Signup V3 (SSO enforced)", () => {beforeAll(async () => {await seedVerifiedEmailDomain(TEST_ORG_ID, TEST_DOMAIN, getDb());+ // samlLogin reads the org's SAML config, so seed one to keep this spec self-contained.+ await seedSamlConfig(TEST_ORG_ID, getDb(), { authProvider: "okta-saml" });// When SSO is enforced, the verified domain + IdP are authoritative.await getDb()(TableName.Organization).where({ id: TEST_ORG_ID }).update({ authEnforced: true });});@@ -35,6 +38,7 @@ describe("Auth SSO Signup V3 (SSO enforced)", () => {await db(TableName.Membership).whereIn("actorUserId", createdUserIds).del();await db(TableName.Users).whereIn("id", createdUserIds).where("id", "!=", seedData1.id).del();}+ await cleanupSamlConfig(TEST_ORG_ID, db);await cleanupEmailDomains(TEST_ORG_ID, db);});diff --git a/backend/e2e-test/testUtils/saml-config.ts b/backend/e2e-test/testUtils/saml-config.tsnew file mode 100644index 0000000000..68a98afb58--- /dev/null+++ b/backend/e2e-test/testUtils/saml-config.ts@@ -0,0 +1,31 @@+import { Knex } from "knex";++import { TableName } from "@app/db/schemas";++// Seeds a minimal SAML config so SSO-login specs are self-contained rather than relying on the+// absence of a config. samlLogin() only reads `enableGroupSync` and stamps `lastUsed` from this row+// (the SAML assertion itself is validated upstream by passport), so the encrypted blobs only need to+// satisfy the NOT NULL constraints — they're never decrypted on this path.+export const seedSamlConfig = async (+ orgId: string,+ knex: Knex,+ { authProvider = "okta-saml" }: { authProvider?: string } = {}+) => {+ const placeholder = Buffer.from("placeholder");+ const [record] = await knex(TableName.SamlConfig)+ .insert({+ orgId,+ authProvider,+ isActive: true,+ encryptedSamlEntryPoint: placeholder,+ encryptedSamlIssuer: placeholder,+ encryptedSamlCertificate: placeholder,+ enableGroupSync: false+ })+ .returning("*");+ return record;+};++export const cleanupSamlConfig = async (orgId: string, knex: Knex) => {+ await knex(TableName.SamlConfig).where({ orgId }).del();+};diff --git a/backend/src/services/auth/auth-signup-service.ts b/backend/src/services/auth/auth-signup-service.tsindex 9222da1736..c243ac4b96 100644--- a/backend/src/services/auth/auth-signup-service.ts+++ b/backend/src/services/auth/auth-signup-service.ts@@ -55,6 +55,10 @@ export const authSignupServiceFactory = ({throw new Error("Provided a disposable email");}+ // Acquire cooldown before any operation to avoid reliable enumeration oracle and to throttle the+ // unauthenticated DB queries below (e.g. the SSO-enforced domain lookup).+ const { emailHash, cooldownSeconds } = await tokenService.acquireEmailSignupCooldown(sanitizedEmail);+// Block email/password signup for domains owned by an org that enforces SSO. The org's verified// domain + IdP are authoritative, so allowing a competing password account would reopen an// account-takeover vector. Domain ownership isn't secret, so surfacing this is acceptable.@@ -72,9 +76,6 @@ export const authSignupServiceFactory = ({}}- // Acquire cooldown before any operation to avoid reliable enumeration oracle- const { emailHash, cooldownSeconds } = await tokenService.acquireEmailSignupCooldown(sanitizedEmail);-// Case sensitive email resolutionconst existingUser = await userDAL.findOne({ username: sanitizedEmail });if (existingUser?.isAccepted) {