History

Use synthetic placeholders in admin plane comments and tests

Rhys Sullivan committed 3 months ago

Commit a0a398e1 parent 7e2f76b2 files · +6 −6Browse files

Unified · Split

2 files
  1. apps/cloud/src/admin/admin-users-api.ts +1 −1
  2. apps/cloud/src/auth/org-api-key-mint.node.test.ts +5 −5
apps/cloud/src/admin/admin-users-api.ts+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
7// 1. an ORG-SCOPED api key -> `PlatformAuth`. The key IS the authority: WorkOS7// 1. an ORG-SCOPED api key -> `PlatformAuth`. The key IS the authority: WorkOS
8// validated it and reported which org owns it, and there is no member8// validated it and reported which org owns it, and there is no member
9// behind it to check membership for. This is the machine credential9// behind it to check membership for. This is the machine credential
10// (owner.com's server calling us).10// (a customer's backend calling us).
11// 2. an admin SESSION member -> the console. Requires a live `getUserOrgMembership`11// 2. an admin SESSION member -> the console. Requires a live `getUserOrgMembership`
12// whose role slug is `admin` AND whose status is `active`, matching the12// whose role slug is `admin` AND whose status is `active`, matching the
13// strictest existing cloud guard (`auth/handlers.ts`'s org-delete check) —13// strictest existing cloud guard (`auth/handlers.ts`'s org-delete check) —
apps/cloud/src/auth/org-api-key-mint.node.test.ts+5−5
@@ -64,10 +64,10 @@ describe("organization API keys", () => { · 63 unmodified lines
64 }),64 }),
65 });65 });
66 66
67 const created = yield* apiKeys.createOrgKey({ organizationId: ORG, name: "owner.com" });67 const created = yield* apiKeys.createOrgKey({ organizationId: ORG, name: "acme-backend" });
68 68
69 expect(created.id).toBe("key_org_1");69 expect(created.id).toBe("key_org_1");
70 expect(created.name).toBe("owner.com");70 expect(created.name).toBe("acme-backend");
71 expect(created.value, "create returns the one-time plaintext secret").toBe(71 expect(created.value, "create returns the one-time plaintext secret").toBe(
72 "sk_org_plaintext",72 "sk_org_plaintext",
73 );73 );
@@ -84,7 +84,7 @@ describe("organization API keys", () => { · 10 unmodified lines
84 Effect.succeed({84 Effect.succeed({
85 object: "list",85 object: "list",
86 data: [86 data: [
87 orgKeyResponse(organizationId, "key_org_1", "owner.com"),87 orgKeyResponse(organizationId, "key_org_1", "acme-backend"),
88 orgKeyResponse(organizationId, "key_org_2", "ci"),88 orgKeyResponse(organizationId, "key_org_2", "ci"),
89 ],89 ],
90 listMetadata: { before: null, after: null },90 listMetadata: { before: null, after: null },
@@ -93,7 +93,7 @@ describe("organization API keys", () => { · 2 unmodified lines
93 93
94 const keys = yield* apiKeys.listOrgKeys({ organizationId: ORG });94 const keys = yield* apiKeys.listOrgKeys({ organizationId: ORG });
95 95
96 expect(keys.map((key) => key.name)).toEqual(["owner.com", "ci"]);96 expect(keys.map((key) => key.name)).toEqual(["acme-backend", "ci"]);
97 expect(JSON.stringify(keys), "the list never carries a plaintext secret").not.toContain(97 expect(JSON.stringify(keys), "the list never carries a plaintext secret").not.toContain(
98 "sk_org_plaintext",98 "sk_org_plaintext",
99 );99 );
@@ -136,7 +136,7 @@ describe("organization API keys", () => { · 36 unmodified lines
136 });136 });
137 137
138 const error = yield* Effect.flip(138 const error = yield* Effect.flip(
139 apiKeys.createOrgKey({ organizationId: ORG, name: "owner.com" }),139 apiKeys.createOrgKey({ organizationId: ORG, name: "acme-backend" }),
140 );140 );
141 141
142 expect(error).toBeInstanceOf(ApiKeyManagementError);142 expect(error).toBeInstanceOf(ApiKeyManagementError);