Strict Tenant ID Enforcement (#3871)

* strict tenant id enforcement

* k

* k

* nit

* merge

* nit

* k
This commit is contained in:
pablonyx
2025-02-18 16:52:56 -08:00
committed by GitHub
parent 2013beb9e0
commit 47fd4fa233
68 changed files with 390 additions and 357 deletions

View File

@ -107,7 +107,7 @@ class OnyxLoggingAdapter(logging.LoggerAdapter):
# This will always be the case for authenticated API requests
if MULTI_TENANT:
tenant_id = CURRENT_TENANT_ID_CONTEXTVAR.get()
if tenant_id != POSTGRES_DEFAULT_SCHEMA:
if tenant_id != POSTGRES_DEFAULT_SCHEMA and tenant_id is not None:
# Strip tenant_ prefix and take first 8 chars for cleaner logs
tenant_display = tenant_id.removeprefix(TENANT_ID_PREFIX)
short_tenant = (