From 2bbcafecd7e5b07fc8ad9791eb1c373f8c400feb Mon Sep 17 00:00:00 2001 From: Dustin Healy <54083382+dustinhealy@users.noreply.github.com> Date: Mon, 1 Jun 2026 21:35:22 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore:=20Allowlist=20AuditLog=20?= =?UTF-8?q?in=20the=20tenant-isolation=20coverage=20guard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The AuditLog collection carries a tenantId field but scopes tenancy manually inside listAuditLogPage / streamAuditLogEntries / recordAuditEntry using the same $exists: false convention as SystemGrant. The tenant-isolation plugin coverage spec now allows that and asserts it stays accurate. --- .../src/models/plugins/tenantIsolation.coverage.spec.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/data-schemas/src/models/plugins/tenantIsolation.coverage.spec.ts b/packages/data-schemas/src/models/plugins/tenantIsolation.coverage.spec.ts index 61708666f1..6f318abe10 100644 --- a/packages/data-schemas/src/models/plugins/tenantIsolation.coverage.spec.ts +++ b/packages/data-schemas/src/models/plugins/tenantIsolation.coverage.spec.ts @@ -13,10 +13,12 @@ const TENANT_ISOLATION_APPLIED = Symbol.for('librechat:tenantIsolation'); * tenant-isolation plugin. SystemGrant scopes tenancy manually inside its * methods (see models/systemGrant). SkillSyncStatus stores both app-wide YAML * status rows and tenant-scoped override rows, so its methods apply explicit - * tenant filters instead of ambient ALS scoping. Adding an entry here must be a - * deliberate, reviewed decision — that is the whole point of this guard. + * tenant filters instead of ambient ALS scoping. AuditLog composes its tenant + * filter from the JWT-resolved caller and uses `{ tenantId: { $exists: false } }` + * for platform-level entries. Adding an entry here must be a deliberate, + * reviewed decision — that is the whole point of this guard. */ -const MANUAL_TENANT_SCOPING = new Set(['SystemGrant', 'SkillSyncStatus']); +const MANUAL_TENANT_SCOPING = new Set(['SystemGrant', 'SkillSyncStatus', 'AuditLog']); function isPluginApplied(schema: mongoose.Schema): boolean { return (schema as unknown as { [key: symbol]: boolean })[TENANT_ISOLATION_APPLIED] === true;