Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(entitlements): restrict audit logs to enterprise plans (#19170)

Steffen Reutherf24a24129c28
diff --git a/web/src/__tests__/server/batchExport-trpc.servertest.ts b/web/src/__tests__/server/batchExport-trpc.servertest.ts
index 4fe0a602cb..ee6a2f0f0b 100644
--- a/web/src/__tests__/server/batchExport-trpc.servertest.ts
+++ b/web/src/__tests__/server/batchExport-trpc.servertest.ts
@@ -93,14 +93,14 @@ describe("batchExport tRPC – audit_logs table authorization", () => {
});
});
- it("blocks a MEMBER (no projectAuditLogs:read) from exporting audit_logs even on cloud:team plan", async () => {
+ it("blocks a MEMBER (no projectAuditLogs:read) from exporting audit_logs even on cloud:enterprise plan", async () => {
const { project, org } = await createOrgProjectAndApiKey();
__orgIds.push(org.id);
const caller = appRouter.createCaller({
...createInnerTRPCContext({
session: makeSession(org.id, org.name, project.id, project.name, {
- plan: "cloud:team",
+ plan: "cloud:enterprise",
projectRole: "MEMBER",
}),
headers: {},
@@ -113,29 +113,32 @@ describe("batchExport tRPC – audit_logs table authorization", () => {
).rejects.toMatchObject({ code: "FORBIDDEN" });
});
- it("blocks an OWNER on cloud:hobby (no audit-logs entitlement) from exporting audit_logs", async () => {
- const { project, org } = await createOrgProjectAndApiKey();
- __orgIds.push(org.id);
+ it.each<Plan>(["cloud:hobby", "cloud:team"])(
+ "blocks an OWNER on %s (no audit-logs entitlement) from exporting audit_logs",
+ async (plan) => {
+ const { project, org } = await createOrgProjectAndApiKey();
+ __orgIds.push(org.id);
- const caller = appRouter.createCaller({
- ...createInnerTRPCContext({
- session: makeSession(org.id, org.name, project.id, project.name, {
- plan: "cloud:hobby",
- projectRole: "OWNER",
+ const caller = appRouter.createCaller({
+ ...createInnerTRPCContext({
+ session: makeSession(org.id, org.name, project.id, project.name, {
+ plan,
+ projectRole: "OWNER",
+ }),
+ headers: {},
}),
- headers: {},
- }),
- prisma,
- });
+ prisma,
+ });
- await expect(
- caller.batchExport.create(exportInput(project.id)),
- ).rejects.toMatchObject({ code: "FORBIDDEN" });
- });
+ await expect(
+ caller.batchExport.create(exportInput(project.id)),
+ ).rejects.toMatchObject({ code: "FORBIDDEN" });
+ },
+ );
it.each<[Plan, Role]>([
- ["cloud:team", "OWNER"],
- ["cloud:team", "ADMIN"],
+ ["cloud:enterprise", "OWNER"],
+ ["cloud:enterprise", "ADMIN"],
["self-hosted:enterprise", "OWNER"],
])(
"allows plan=%s role=%s (both entitlement and projectAuditLogs:read) to export audit_logs",
@@ -210,7 +213,7 @@ describe("batchExport tRPC – audit_logs download and list authorization", () =
const memberCaller = appRouter.createCaller({
...createInnerTRPCContext({
session: makeSession(org.id, org.name, project.id, project.name, {
- plan: "cloud:team",
+ plan: "cloud:enterprise",
projectRole: "MEMBER",
}),
headers: {},
@@ -268,7 +271,7 @@ describe("batchExport tRPC – audit_logs download and list authorization", () =
const caller = appRouter.createCaller({
...createInnerTRPCContext({
session: makeSession(org.id, org.name, project.id, project.name, {
- plan: "cloud:team",
+ plan: "cloud:enterprise",
projectRole: "OWNER",
}),
headers: {},
@@ -331,7 +334,7 @@ describe("batchExport tRPC – audit_logs download and list authorization", () =
const memberCaller = appRouter.createCaller({
...createInnerTRPCContext({
session: makeSession(org.id, org.name, project.id, project.name, {
- plan: "cloud:team",
+ plan: "cloud:enterprise",
projectRole: "MEMBER",
}),
headers: {},
@@ -369,7 +372,7 @@ describe("batchExport tRPC – audit_logs download and list authorization", () =
const caller = appRouter.createCaller({
...createInnerTRPCContext({
session: makeSession(org.id, org.name, project.id, project.name, {
- plan: "cloud:team",
+ plan: "cloud:enterprise",
projectRole: "OWNER",
}),
headers: {},
diff --git a/web/src/features/entitlements/constants/entitlements.ts b/web/src/features/entitlements/constants/entitlements.ts
index 58938a1b1f..9206934f90 100644
--- a/web/src/features/entitlements/constants/entitlements.ts
+++ b/web/src/features/entitlements/constants/entitlements.ts
@@ -98,7 +98,6 @@ export const entitlementAccess: Record<
entitlements: [
...cloudAllPlansEntitlements,
"rbac-project-roles",
- "audit-logs",
"data-retention",
"cloud-multi-tenant-sso",
"prompt-protected-labels",