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
Merge tests/secrets-phase-3-automation into tests/secrets-phase-4-fakes
varonix66b91a8ad5d5
diff --cc backend/e2e-test/routes/v1/access-approval-global-request-routing.spec.tsindex d64750c06f,57f8b89f3b..840ab927db--- a/backend/e2e-test/routes/v1/access-approval-global-request-routing.spec.ts+++ b/backend/e2e-test/routes/v1/access-approval-global-request-routing.spec.ts@@@ -197,4 -200,79 +198,31 @@@ describe("Access approval request routiconst grants = await db(TableName.ApprovalRequestGrants).where({ requestId });expect(grants).toHaveLength(0);});+- test("Creating a request on the global system sends the access request webhook", async () => {- const secretPath = "/routing-global-webhook";- const fakeWebhookServer = await createFakeWebhookServer();- const webhook = await createWebhook({- projectId: seedData1.project.id,- environmentSlug: seedData1.environment.slug,- webhookUrl: fakeWebhookServer.url,- authToken: jwtAuthToken- });-- try {- const createRes = await createGlobalPolicy({ name: "routing-global-webhook", secretPath });- expect(createRes.statusCode).toBe(200);- const policyId = createRes.json().approval.id as string;-- const res = await createAccessRequest(secretPath);- expect(res.statusCode).toBe(200);- const { approval } = res.json();-- const message = await fakeWebhookServer.waitForMessage(- (m) => (m.body as { request?: { id?: string } })?.request?.id === approval.id,- 10_000- );- expect(message.body).toMatchObject({- event: "secrets.access-request.modified",- action: "created",- project: { id: seedData1.project.id },- request: {- id: approval.id,- status: "pending",- isBypassed: false,- policy: { id: policyId, name: "routing-global-webhook", hasSequencedApprovers: false },- requestedAccess: {- target: { environment: { slug: seedData1.environment.slug }, secretPath },- isTemporary: false,- permissions: [{ subject: "secrets", actions: ["read"] }]- },- requestedBy: { type: "user", id: seedData1.id },- approvedAt: null,- revokedAt: null- }- });- } finally {- await getDb()(TableName.Webhook).where({ id: webhook.id }).del();- await fakeWebhookServer.stop();- }- }, 30_000);-+ test("A migrated policy's legacy row does not take requests for the path it moved away from", async () => {+ const secretPath = "/routing-migrated";+ const created = await createGlobalPolicy({ name: "routing-migrated", secretPath });+ expect(created.statusCode).toBe(200);+ const policyId: string = created.json().approval.id;+ await createLegacyPolicy({ id: policyId, name: "routing-migrated", secretPath });++ const moved = await testServer.inject({+ method: "PATCH",+ url: `/api/v1/access-approvals/policies/${policyId}`,+ headers: {+ authorization: `Bearer ${jwtAuthToken}`+ },+ body: {+ secretPath: "/routing-migrated-moved",+ approvers: [{ type: ApproverType.User, id: seedData1.id }],+ approvals: 1+ }+ });+ expect(moved.statusCode).toBe(200);++ const res = await createAccessRequest(secretPath);++ expect(res.statusCode).toBe(404);+ expect(res.json().message).toContain("No policy in environment");+ });});diff --cc backend/e2e-test/setup/reset-fakes.tsindex f242f3ff07,66e2dc9d3d..bef12aec4b--- a/backend/e2e-test/setup/reset-fakes.ts+++ b/backend/e2e-test/setup/reset-fakes.ts@@@ -1,6 -1,8 +1,7 @@@import { auditLogStreamOutboxTuning } from "e2e-test/fakes/audit-log-stream-outbox-constants";import { fakeAwsConnection } from "e2e-test/fakes/aws-connection-fns";import { fakeIamUserSecret } from "e2e-test/fakes/aws-iam-user-secret-rotation-fns";-import { fakeParameterStore } from "e2e-test/fakes/aws-parameter-store-sync-fns";+ import { fakeDefaultStorage } from "e2e-test/fakes/object-storage-default-fns";import { fakeS3Bucket } from "e2e-test/fakes/s3";// The fakes are module singletons shared with the server booted in this same process, and the@@@ -14,8 -16,10 +15,9 @@@//// A spec still resets between its own tests; that is its own beforeEach, not this hook.beforeAll(() => {- fakeParameterStore.reset();fakeAwsConnection.reset();fakeS3Bucket.reset();+ fakeDefaultStorage.reset();fakeIamUserSecret.reset();auditLogStreamOutboxTuning.reset();});diff --cc tests/cmd/fakenet/main.goindex d8b5c82f67,41de44c1f2..ddfd5d0934--- a/tests/cmd/fakenet/main.go+++ b/tests/cmd/fakenet/main.go@@@ -14,11 -14,10 +14,12 @@@ import"net/http""os"+ "github.com/Infisical/infisical/tests/fakes/aws""github.com/Infisical/infisical/tests/fakes/github""github.com/Infisical/infisical/tests/fakes/license"+ "github.com/Infisical/infisical/tests/fakes/oidcidp""github.com/Infisical/infisical/tests/fakes/smtp"+ "github.com/Infisical/infisical/tests/fakes/webhook""github.com/Infisical/infisical/tests/infra/fakenet")@@@ -36,9 -35,7 +37,10 @@@ func main()srv := fakenet.New(github.Service,license.Service,+ oidcidp.Service,+ webhook.Service,+ webhook.Slack,+ aws.STS, aws.SSM, aws.SecretsManager, aws.IAM, aws.CloudFormation,)mail := smtp.New(func(domain string) fakenet.Emitter { return srv.Emitter(smtp.Host, domain) })