Skip to content
Centriu
Centriu Synapse

Knowledge-Base Search Tenant Scope Integrity Automation: One Clause That Switched Off the Only Guard

Centriu Synapse's AI assistant answers customer questions in part by retrieving relevant chunks from a knowledge base scoped to the organization and, where one applies, the specific tenant asking. The retrieval function's own scope predicate contained a clause that, for a caller resolved without a specific tenant — the documented, normal shape for an organization-wide credential in an organization running more than one active client — switched the tenant filter off entirely rather than narrowing it. That caller received every tenant's content in the organization, private material included, from a single retrieval call. Confirmed directly from the fix's own measurement: it was the ONLY guard in the path, because the function runs with elevated database privilege that bypasses row-level security, and the table's own access policy checks organization membership only, nothing about tenant. A four-probe test — a caller scoped correctly to one tenant, a caller scoped to a different tenant, a caller from a different organization entirely, and the org-wide caller — proved the leak existed only for the fourth case, and proved the fix closed exactly that case without changing what any of the other three receive, or touching a single row of underlying data.
Four probes, zero regression
One clause, only guard
Knowledge base document library screen
One clause switched off the only guard.

The absence of a value and the presence of everything can look identical in a boolean check

A scope filter that reads "if a specific value is provided, narrow to it" is a natural, common pattern — and it carries a quiet trap. Writing that same idea as "if the value is absent, skip the narrowing" instead of "if the value is absent, match only what has no owner" silently converts a legitimate case — a caller with no specific sub-scope — into a caller who sees literally everything, because an empty condition in a filter does not mean 'match nothing new,' it means 'stop filtering.' The two phrasings look almost identical in code and produce opposite security properties.

How the underlying problem shows up before you fix it

A scope-narrowing clause is written as "skip this condition when the value is absent" rather than "when the value is absent, match only records that themselves have no owner at that level."

The affected function runs with elevated database privilege (bypassing row-level security) specifically for performance or architectural reasons, meaning its own internal predicate is not a second layer of defense — it is the only layer.

The table's own access policy checks a coarser boundary (organization membership) than the function needs to enforce (organization AND tenant), so the policy alone cannot catch a gap in the function's own finer-grained filter.

A caller resolved without a specific sub-scope is not a rare or malformed edge case — it is the correctly documented shape for a specific, real kind of credential, meaning the gap fires under normal, expected use, not only under misuse.

Proving the leak (and, later, proving the fix) requires probing all the boundary cases together — a correctly-scoped caller, a differently-scoped caller, an out-of-organization caller, and the affected caller — not just confirming the affected case changed, because a fix that also silently narrows an already-correct case is its own new defect.

How one disabling clause was found, measured, and removed without touching a byte of data

Centriu Synapse's AI assistant retrieves relevant knowledge-base content through a dedicated database function before generating a response, filtering the underlying chunks by organization and, where the calling context has one, by the specific tenant it belongs to. The function's scope predicate read: match chunks in the caller's organization, and match on tenant only if the caller's own tenant value is present — otherwise, skip the tenant condition entirely.

That second half is the defect. "Skip the condition" does not mean "match only tenant-less, organization-wide content," which is what a caller with no specific tenant is actually entitled to see — it means the database applies no tenant filter at all, and every chunk in the organization, regardless of which tenant it privately belongs to, satisfies the query. The caller this affects is not hypothetical or malformed: an organization-wide API credential, used in an organization that runs more than one active tenant, is a documented, ordinary shape of caller in this system — and every one of that shape's retrieval calls returned content it had no scope to see.

Confirmed directly from the fix's own investigation why nothing else caught this: the retrieval function is declared to run with the INVOKER's privilege in name, but the backend always calls it using an elevated, row-level-security-bypassing database role — meaning the table's own access policy never gets a chance to apply during this specific call path. That policy, in any case, only verifies organization membership, with no clause about tenant at all. The predicate inside the function itself was therefore not a second, defense-in-depth layer behind the table's own policy — it was the only guard standing between one tenant's private knowledge base and another's, for this entire code path.

The proof, both of the leak and of the fix, came from a single four-probe measurement rather than a single before/after comparison. A caller correctly scoped to one specific tenant, both before and after the fix, received exactly that tenant's own matching content — unaffected, confirming the fix does not narrow a case that was already correct. A caller scoped to a different specific tenant showed the same: correct and unaffected on both sides. A caller from an entirely different organization received nothing, in both measurements — organization-level separation was never the broken part, and remained intact throughout. Only the fourth case — the organization-wide caller — showed a difference: every tenant's content, before; none of a specific tenant's private content, after, correctly leaving only genuinely organization-wide material (content with no specific tenant owner) reachable. The count of chunks actually stored in the underlying table was identical in both measurements, confirming the fix changed what a QUERY is allowed to return, not what data exists or how much of it there is.

The fix itself is a single removed clause: the predicate no longer treats an absent tenant value as a reason to stop filtering — it now treats it as a reason to match only chunks that are themselves genuinely organization-wide, the behavior an organization-wide caller was always supposed to get.

What is actually built today

The knowledge-base retrieval function's scope predicate no longer disables tenant filtering for any caller — an organization-wide caller matches only organization-wide content, never a specific tenant's private material.

The fix is verified by a four-probe test naming every boundary case together: a correctly-scoped tenant caller, a different tenant caller, a different-organization caller, and the organization-wide caller — proving the corrected case closed without regressing any of the other three.

The underlying data was never touched — the fix changes the function's own query logic (a `create or replace function`), with no schema change and no row rewritten.

Organization-level isolation, which was already correctly enforced by the table's own access policy, is independently reconfirmed intact by the same measurement, not merely assumed to still work.

The retrieval function continues to run under the backend's own elevated database role for its architectural reasons — the fix hardens the function's own internal predicate specifically because that role bypasses row-level security, rather than relying on a security model the call path does not actually use.

A documented, deliberate behavior change ships alongside the fix: any integration that had been (unknowingly) relying on an organization-wide caller seeing specific-tenant content will now see less — the correct amount, not the previous, leaked amount.

One credential, every tenant's knowledge (illustrative framing of the actual measured finding)

An organization runs Centriu Synapse for several of its own active tenants at once, using one organization-wide API credential for a shared integration. Before the fix, a knowledge-base query made with that credential returns matching content from every one of those tenants — including material that tenant never authorized the organization-wide integration to see. After the fix, the identical query returns only the organization's own genuinely shared, tenant-less knowledge base content — a specific tenant's private material stays private unless the caller is scoped to that exact tenant.

What changes operationally

Centriu Synapse's knowledge-base retrieval function now enforces tenant scope for every caller shape, including the organization-wide case that previously disabled the filter entirely — proven by a four-probe measurement that confirms the fix narrows only the case that was actually leaking, with organization-level isolation and correctly-scoped tenant callers both unaffected.

When this is not the right fit

This automation governs the internal scope-filtering logic of Centriu Synapse's own knowledge-base retrieval function — it does not change what content an organization chooses to add to its knowledge base, does not add a new access-control layer a customer configures directly, and does not affect organization-level isolation, which was already correctly enforced and remains unchanged.

One filter as the only guard vs. a filter with an independent second check

Relying on a single, well-written filter is efficient and, for as long as it stays correctly written, entirely sufficient — the risk is not the pattern itself but the absence of any independent check confirming it stays correct when a call path bypasses the layer (row-level security) that would ordinarily catch a filter written by mistake to match too much. Where a function runs with elevated privilege specifically because it needs to bypass that layer, its own internal predicate stops being one guard among several and becomes the only one — worth treating with the scrutiny, and the boundary-case testing, that fact implies.

Related systems

Main system: Centriu Synapse.

What it does NOT do

  • Does not change what content an organization or a specific tenant chooses to add to the knowledge base — this fix governs only which existing content a given caller's query is permitted to retrieve.
  • Does not add a new, customer-facing access-control setting — the scoping behavior corrected here was always the intended design; the fix restores it rather than introducing a new capability.
  • Does not affect organization-level isolation, which the four-probe measurement confirmed was already correct and remains unchanged before and after the fix.
  • Does not retroactively identify which specific past queries, if any, retrieved content outside their intended tenant scope — a team with that concern should review its own integration logs for the affected window.
  • Does not change how the knowledge-base retrieval function is called from elsewhere in Centriu Synapse — the fix is entirely inside the function's own query logic.
  • Does not require any application code change to take effect — the fix is a database-level function replacement, applied without touching any stored data.

Security and governance

Centriu Synapse's knowledge-base retrieval function scopes every query by organization and tenant, with no caller shape able to disable the tenant filter — verified by a four-probe measurement covering correctly-scoped, differently-scoped, out-of-organization, and organization-wide callers. Any personal or business data referenced in a knowledge base remains subject to Brazil's LGPD (Law No. 13,709/2018). Full detail on access control lives at /governanca and /iso.

Pricing and contracting

Available by monthly subscription, with tiered plans. Values and terms come from the official pricing table at /precos (Centriu's central source — never restated here).

Frequently asked questions

Was this leak measured directly, or inferred from reading the code?

Measured directly with a four-probe test: a correctly-scoped tenant caller, a different tenant caller, a different-organization caller, and the organization-wide caller — only the last one showed the leak, both before and after the fix, proving exactly what changed.

Did fixing this touch or move any stored data?

No — the fix replaces the retrieval function's own query logic. No schema changed and no row was rewritten; the chunk count in the underlying table was identical before and after.

Which callers were affected?

Only an organization-wide credential in an organization running more than one active tenant — the documented, normal shape for that kind of key. A caller already scoped to a specific tenant, or one from a different organization, was unaffected by both the bug and the fix.

Why didn't the database's own row-level security catch this?

The retrieval function is called through an elevated database role that bypasses row-level security for architectural reasons, and the table's own access policy checks organization membership only — neither one enforces tenant scope, which made the function's own predicate the sole guard.

Is this the same fix as the AI agent and BYO LLM key cross-tenant selection page?

No — that fix closes a missing organization filter on two different functions (choosing which custom AI agent and which billing key to use). This fix closes a disabled tenant filter on the knowledge-base retrieval function specifically.

What does Centriu Synapse cost?

It is sold by subscription with a published starting price — exact current values are on the central pricing page.

See how Centriu Synapse scopes knowledge-base search by tenant

Reach our commercial team directly, or leave your details below — we'll follow up with guidance for your case.

Sources

  1. Centriu Synapse — public product page — Centriu, 2026-07-20 · link(primária)
  2. Centriu Synapse — public factsheet (API, JSON) — Centriu, 2026-07-21 · link
  3. Law No. 13,709/2018 — Brazil’s General Data Protection Law (LGPD) — Presidência da República (Brazil), 2018-08-14 · link

Last material update on .

By · AI-assisted production, with human review