Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

test(e2e): remove legacy cases ported to the Go suite

varonix95099bbb12f4
diff --git a/backend/e2e-test/routes/v1/insights.spec.ts b/backend/e2e-test/routes/v1/insights.spec.ts
index 8ffed2d6fd..d484a96e65 100644
--- a/backend/e2e-test/routes/v1/insights.spec.ts
+++ b/backend/e2e-test/routes/v1/insights.spec.ts
@@ -1,36 +1,14 @@
import { describe, expect, test } from "vitest";
-const PROJECTS_URL = "/api/v1/insights/secrets/projects";
-
-// Every org-scoped insight, by the URL the router registers it at. The aggregation behind each one is
-// covered against a real database (or a faked ClickHouse) in the e2e-test/insights-*.spec.ts files,
-// including the plan gate. This file only asserts the wiring. The e2e license mock includes insights,
-// so the seeded admin clears both the permission and the plan check.
-const DATABASE_BACKED_URLS = {
- summary: "/api/v1/insights/secrets/summary",
- projects: PROJECTS_URL,
- staticSecrets: "/api/v1/insights/secrets/usage/static-secrets"
-};
-
-// These read audit logs from ClickHouse, which the e2e instance does not run.
+// The database-backed org insights, their validation and search by value are covered in
+// tests/suites/secretmanager/insights. These read audit logs from ClickHouse, which neither the e2e
+// instance nor the Go suite runs, and the Go client has no operation for them.
const CLICKHOUSE_BACKED_URLS = {
accessVolume: "/api/v1/insights/secrets/access-volume",
authMethods: "/api/v1/insights/secrets/usage/auth-methods"
};
-const ORG_SCOPED_URLS = { ...DATABASE_BACKED_URLS, ...CLICKHOUSE_BACKED_URLS };
-
describe("Insights V1 Router (org-scoped)", async () => {
- test.each(Object.entries(DATABASE_BACKED_URLS))("GET %s is registered and answers", async (_, url) => {
- const res = await testServer.inject({
- method: "GET",
- url,
- headers: { authorization: `Bearer ${jwtAuthToken}` }
- });
-
- expect(res.statusCode).toBe(200);
- });
-
test.each(Object.entries(CLICKHOUSE_BACKED_URLS))(
"GET %s is registered and says ClickHouse is required",
async (_, url) => {
@@ -45,42 +23,9 @@ describe("Insights V1 Router (org-scoped)", async () => {
}
);
- test.each(Object.entries(ORG_SCOPED_URLS))("GET %s requires authentication", async (_, url) => {
+ test.each(Object.entries(CLICKHOUSE_BACKED_URLS))("GET %s requires authentication", async (_, url) => {
const res = await testServer.inject({ method: "GET", url });
expect(res.statusCode).toBe(401);
});
-
- // What value search finds is covered in routes/v3/secrets-management.spec.ts.
- test("POST secrets search-by-value rejects an empty value", async () => {
- const res = await testServer.inject({
- method: "POST",
- url: "/api/v1/insights/secrets/search-by-value",
- headers: { authorization: `Bearer ${jwtAuthToken}` },
- body: { secretValue: "" }
- });
-
- expect(res.statusCode).toBe(422);
- });
-
- test("GET secrets projects rejects an out-of-bounds limit", async () => {
- const res = await testServer.inject({
- method: "GET",
- url: `${PROJECTS_URL}?limit=500`,
- headers: { authorization: `Bearer ${jwtAuthToken}` }
- });
-
- // Schema validation failures map to 422 (ValidationError in error-handler.ts)
- expect(res.statusCode).toBe(422);
- });
-
- test("GET secrets projects rejects a negative offset", async () => {
- const res = await testServer.inject({
- method: "GET",
- url: `${PROJECTS_URL}?offset=-1`,
- headers: { authorization: `Bearer ${jwtAuthToken}` }
- });
-
- expect(res.statusCode).toBe(422);
- });
});
diff --git a/backend/e2e-test/routes/v1/project.spec.ts b/backend/e2e-test/routes/v1/project.spec.ts
index c9541907b8..b5b8b151ec 100644
--- a/backend/e2e-test/routes/v1/project.spec.ts
+++ b/backend/e2e-test/routes/v1/project.spec.ts
@@ -108,19 +108,6 @@ describe("Project deletion (soft-delete + async cleanup)", async () => {
});
describe("Project update (audit logs retention)", async () => {
- test("rejects a retention period the plan does not allow", async () => {
- const project = await createProject("e2e-retention-plan-limit");
-
- const res = await updateProject(project.id, { auditLogsRetentionDays: 30 });
-
- expect(res.statusCode).toBe(400);
- expect(JSON.parse(res.payload).message).toContain("audit logs");
-
- expect(JSON.parse((await getProject(project.id)).payload).project.auditLogsRetentionDays).toBeNull();
-
- await deleteProject(project.id);
- });
-
test("leaves other fields updatable", async () => {
const project = await createProject("e2e-retention-other-fields");
diff --git a/backend/e2e-test/routes/v1/secret-reminder.spec.ts b/backend/e2e-test/routes/v1/secret-reminder.spec.ts
index aed50d700b..16e5fc5029 100644
--- a/backend/e2e-test/routes/v1/secret-reminder.spec.ts
+++ b/backend/e2e-test/routes/v1/secret-reminder.spec.ts
@@ -1,4 +1,4 @@
-import { OrgMembershipRole, ProjectMembershipRole, SecretType } from "@app/db/schemas";
+import { OrgMembershipRole, ProjectMembershipRole } from "@app/db/schemas";
import { up as migrateRemindersToAlerts } from "../../../src/db/migrations/20260929130000_migrate-secret-reminders-to-alerts";
import { updateAlert } from "../../testUtils/alerts";
@@ -15,7 +15,7 @@ import {
waitForReminderEmails
} from "../../testUtils/reminders";
import { createSecretApprovalPolicy } from "../../testUtils/secret-approval-policies";
-import { createSecretV2, getSecretByNameV2, updateSecretV2 } from "../../testUtils/secrets";
+import { createSecretV2, getSecretByNameV2 } from "../../testUtils/secrets";
import { addUserMembership, createUser, deleteUsers } from "../../testUtils/users";
const ENVIRONMENT = "dev";
@@ -125,26 +125,6 @@ describe("Secret reminders delivered through alerts", () => {
});
});
- test("the secret listing reports recipients from the reminder's alert", async () => {
- const secretId = await createSecret("LISTING");
- await setSecretReminder({ secretId, authToken, repeatDays: 30, recipients: [member.userId] });
-
- const res = await testServer.inject({
- method: "GET",
- url: "/api/v1/dashboard/secrets-details",
- headers: { authorization: `Bearer ${authToken}` },
- query: { projectId, environment: ENVIRONMENT, secretPath: "/", search: "LISTING", includeSecrets: "true" }
- });
- expect(res.statusCode).toBe(200);
- const [secret] = res.json().secrets as {
- secretReminderRepeatDays: number;
- reminder: { repeatDays: number; recipients: string[] };
- }[];
- expect(secret.secretReminderRepeatDays).toBe(30);
- expect(secret.reminder.repeatDays).toBe(30);
- expect(secret.reminder.recipients).toEqual([member.userId]);
- });
-
test("moving a secret carries its reminder alert to the new secret", async () => {
await createFolder({
workspaceId: projectId,
@@ -301,89 +281,6 @@ describe("Secret reminders delivered through alerts", () => {
await expectAlertFullyRemoved(alert);
});
- test("a secret update sets the reminder and its recipients", async () => {
- const secretId = await createSecret("WITH_UPDATE");
- await updateSecretV2({
- workspaceId: projectId,
- environmentSlug: ENVIRONMENT,
- secretPath: "/",
- key: "WITH_UPDATE",
- value: "rotated",
- reminder: { repeatDays: 14, note: "rotate it", recipients: [member.userId] },
- authToken
- });
-
- const reminder = await getSecretReminder({ secretId, authToken });
- expect(reminder?.repeatDays).toBe(14);
- expect(reminder?.recipients).toEqual([member.userId]);
- });
-
- test("a secret update with recipients outside the project is refused before the secret changes", async () => {
- const secretId = await createSecret("REFUSED");
- const outsider = await newUser("outsider");
-
- await updateSecretV2({
- workspaceId: projectId,
- environmentSlug: ENVIRONMENT,
- secretPath: "/",
- key: "REFUSED",
- value: "rotated",
- reminder: { repeatDays: 14, recipients: [outsider.userId] },
- authToken
- }).expect((res) => {
- expect(res.statusCode).toBe(400);
- expect(res.json<{ message: string }>().message).toMatch(/None of the selected reminder recipients/);
- });
-
- const secret = await getSecretByNameV2({
- workspaceId: projectId,
- environmentSlug: ENVIRONMENT,
- secretPath: "/",
- key: "REFUSED",
- authToken
- });
- expect(secret.secretValue).toBe("value");
- expect(await getSecretReminder({ secretId, authToken })).toBeNull();
- });
-
- // The reminder provider only accepts reminders on shared secrets. That check belongs to the alert
- // module, so this shows a refusal from it now fails the whole update before the secret is written.
- test("a secret update whose reminder the alert module refuses leaves the secret unchanged", async () => {
- await createSecret("PERSONAL_REMINDER");
- await createSecretV2({
- workspaceId: projectId,
- environmentSlug: ENVIRONMENT,
- secretPath: "/",
- key: "PERSONAL_REMINDER",
- value: "personal",
- type: SecretType.Personal,
- authToken
- });
-
- await updateSecretV2({
- workspaceId: projectId,
- environmentSlug: ENVIRONMENT,
- secretPath: "/",
- key: "PERSONAL_REMINDER",
- value: "changed",
- type: SecretType.Personal,
- reminder: { repeatDays: 14 },
- authToken
- }).expect((res) => {
- expect(res.statusCode).toBe(400);
- expect(res.json<{ message: string }>().message).toMatch(/Reminders can only be set on shared secrets/);
- });
-
- const res = await testServer.inject({
- method: "GET",
- url: "/api/v3/secrets/raw/PERSONAL_REMINDER",
- headers: { authorization: `Bearer ${authToken}` },
- query: { workspaceId: projectId, environment: ENVIRONMENT, secretPath: "/", type: SecretType.Personal }
- });
- expect(res.statusCode).toBe(200);
- expect(res.json<{ secret: { secretValue: string } }>().secret.secretValue).toBe("personal");
- });
-
test("deleting a reminder removes its alert, channels and recipients", async () => {
const secretId = await createSecret("DELETE_ME");
await setSecretReminder({ secretId, authToken, repeatDays: 30, recipients: [member.userId] });
diff --git a/backend/e2e-test/routes/v3/secrets-management.spec.ts b/backend/e2e-test/routes/v3/secrets-management.spec.ts
index 3c76193103..949e749fa7 100644
--- a/backend/e2e-test/routes/v3/secrets-management.spec.ts
+++ b/backend/e2e-test/routes/v3/secrets-management.spec.ts
@@ -1,32 +1,9 @@
import { createFakeWebhookServer, TFakeWebhookServer } from "e2e-test/fakes/webhook-destination";
-import { createIsolatedOrgAndProject, createProject } from "e2e-test/testUtils/fixtures";
-import { createFolder } from "e2e-test/testUtils/folders";
-import { createSecretV2, deleteSecretV2, updateSecretV2 } from "e2e-test/testUtils/secrets";
+import { createIsolatedOrgAndProject } from "e2e-test/testUtils/fixtures";
+import { createSecretV2 } from "e2e-test/testUtils/secrets";
import { createWebhook, waitForWebhookRun } from "e2e-test/testUtils/webhooks";
const ENV = "dev";
-const PROD_ENV = "prod";
-
-type TFoundSecret = {
- key: string;
- projectId: string;
- projectName: string;
- environment: { name: string; slug: string };
- secretPath: string;
-};
-
-const searchByValue = async (secretValue: string, authToken: string) => {
- const res = await testServer.inject({
- method: "POST",
- url: "/api/v1/insights/secrets/search-by-value",
- headers: { authorization: `Bearer ${authToken}` },
- body: { secretValue }
- });
- expect(res.statusCode).toBe(200);
- return res.json().secrets as TFoundSecret[];
-};
-
-const at = (secrets: TFoundSecret[]) => secrets.map((s) => `${s.environment.slug}${s.secretPath}${s.key}`).sort();
// Covers domain-level side effects of secrets management actions, as distinct from the routes'
// own CRUD behavior (secrets.spec.ts / tests/suites/secretmanager/secrets). A webhook is the observable signal
@@ -37,13 +14,12 @@ describe("Secrets management", () => {
// than the 5s default.
vi.setConfig({ testTimeout: 30_000, hookTimeout: 30_000 });
- let orgId: string;
let projectId: string;
let authToken: string;
let cleanup: () => Promise<void>;
beforeAll(async () => {
- ({ orgId, projectId, authToken, cleanup } = await createIsolatedOrgAndProject("secrets-management-e2e"));
+ ({ projectId, authToken, cleanup } = await createIsolatedOrgAndProject("secrets-management-e2e"));
});
afterAll(async () => {
@@ -95,128 +71,4 @@ describe("Secrets management", () => {
expect(ranWebhook.lastStatus).toBe("success");
});
});
-
- describe("Finding a secret by its value", () => {
- test("a rotated value stops being found and the new one starts", async () => {
- await createSecretV2({
- workspaceId: projectId,
- environmentSlug: ENV,
- secretPath: "/",
- key: "ROTATES",
- value: "the-old-value",
- authToken
- });
- expect(await searchByValue("the-old-value", authToken)).toHaveLength(1);
-
- await updateSecretV2({
- workspaceId: projectId,
- environmentSlug: ENV,
- secretPath: "/",
- key: "ROTATES",
- value: "the-new-value",
- authToken
- });
-
- expect(await searchByValue("the-old-value", authToken)).toEqual([]);
- expect(await searchByValue("the-new-value", authToken)).toHaveLength(1);
- });
-
- // A rename carries no value, so the secret must still be findable by the value it still holds.
- test("renaming a secret does not stop it being found by its value", async () => {
- await createSecretV2({
- workspaceId: projectId,
- environmentSlug: ENV,
- secretPath: "/",
- key: "BEFORE_RENAME",
- value: "survives-a-rename",
- authToken
- });
-
- await updateSecretV2({
- workspaceId: projectId,
- environmentSlug: ENV,
- secretPath: "/",
- key: "BEFORE_RENAME",
- newKey: "AFTER_RENAME",
- authToken
- });
-
- const found = await searchByValue("survives-a-rename", authToken);
- expect(found).toHaveLength(1);
- expect(found[0].key).toBe("AFTER_RENAME");
- });
-
- test("a deleted secret stops being found", async () => {
- await createSecretV2({
- workspaceId: projectId,
- environmentSlug: ENV,
- secretPath: "/",
- key: "TEMPORARY",
- value: "here-then-gone",
- authToken
- });
- expect(await searchByValue("here-then-gone", authToken)).toHaveLength(1);
-
- await deleteSecretV2({
- workspaceId: projectId,
- environmentSlug: ENV,
- secretPath: "/",
- key: "TEMPORARY",
- authToken
- });
-
- expect(await searchByValue("here-then-gone", authToken)).toEqual([]);
- });
-
- // This is the test the org-scoped index exists for. The project-scoped digest cannot match across
- // projects, so a search that found only the first project would still be broken for the case the
- // feature was built for: a value is believed compromised, so where else is it?
- test("a value held across projects, environments and folders is found in each", async () => {
- const shared = `across-projects-${Date.now()}`;
-
- const secondProjectId = await createProject(authToken, "secrets-management-e2e-second");
- await createFolder({ workspaceId: projectId, environmentSlug: ENV, secretPath: "/", name: "nested", authToken });
-
- const copies = [
- { workspaceId: projectId, environmentSlug: ENV, secretPath: "/", key: "IN_FIRST_ROOT" },
- { workspaceId: projectId, environmentSlug: ENV, secretPath: "/nested", key: "IN_FIRST_NESTED" },
- { workspaceId: projectId, environmentSlug: PROD_ENV, secretPath: "/", key: "IN_FIRST_PROD" },
- { workspaceId: secondProjectId, environmentSlug: ENV, secretPath: "/", key: "IN_SECOND_PROJECT" }
- ];
- for await (const copy of copies) {
- await createSecretV2({ ...copy, value: shared, authToken });
- }
-
- const found = await searchByValue(shared, authToken);
- expect(at(found)).toEqual([
- `${ENV}/IN_FIRST_ROOT`,
- `${ENV}/IN_SECOND_PROJECT`,
- `${ENV}/nestedIN_FIRST_NESTED`,
- `${PROD_ENV}/IN_FIRST_PROD`
- ]);
- expect(new Set(found.map((f) => f.projectId))).toEqual(new Set([projectId, secondProjectId]));
- });
-
- // The org digest is keyed by the org data key, so one org's values must never match another's.
- test("a value held in another organization is not found", async () => {
- const other = await createIsolatedOrgAndProject("secrets-management-e2e-other");
- try {
- const value = "value-in-a-different-org";
- await createSecretV2({
- workspaceId: other.projectId,
- environmentSlug: ENV,
- secretPath: "/",
- key: "OTHER_ORG",
- value,
- authToken: other.authToken
- });
-
- expect(await searchByValue(value, other.authToken)).toHaveLength(1);
- expect(await searchByValue(value, authToken)).toEqual([]);
- expect(other.orgId).not.toBe(orgId);
- } finally {
- await other.cleanup();
- }
- });
- });
});