Applies to v1.3.18

ESRA — Security and Governance

ESRA puts an AI client in front of enterprise databases. Every control below is required, not advisory.


Roles — the ESRA & Data area

ESRA has its own administrative area, so a data-platform owner can hold authority over enterprise data sources and nothing else, and holding a toolset administration role grants no authority over ESRA.

Role Authority
ESRA_DATA_READ read the whole area, exposures included
ESRA_DATA_MANAGE what exists and what is searchable — sources, connections, mappings, fields, capabilities
ESRA_EXPOSURE_MANAGE who gets to see it — exposures, audiences, source subsets, publication

Each is granted either against a tenant or against none — a grant with no tenant is what makes an operator cross-tenant, and there is no separate role name for it. Neither manage role implies the other; both imply read, and each carries the lookups an ESRA screen needs to name a model profile, a client application or a trusted issuer.

Four-role control by construction

Getting enterprise data in front of an AI client requires four role holders, in sequence:

SECURITY_MANAGE       creates and rotates the connection secret
      ↓
ESRA_DATA_MANAGE      models the source, mappings and searchable/returnable fields
      ↓
GOVERNANCE_MANAGE     authors the access policy for the exposure's tool
      ↓
ESRA_EXPOSURE_MANAGE  binds audience and source subset, and publishes

No single role can complete that chain: a holder of exactly one role is refused at the next step.

What ESRA & Data does not own

Surface Owning policy Why
Connection secrets SECURITY_MANAGE secrets stay in one area, always
Service-LLM model profiles AI_SETTINGS_READ to list, ESRA_DATA_MANAGE to bind profiles are owned by AI settings; a capability points at one, and optionally at a different one for each model stage
The exposure's access policy GOVERNANCE_MANAGE who may invoke a tool is a governance decision, uniformly
Retention classification, audit exploration GOVERNANCE_* a compliance surface, not a data-platform surface

The Seven Authorization Layers

  1. Capability invocation — the exposure's access policy, evaluated identically to any other tool. A caller who fails it sees no trace that the tool exists.
  2. Source availability — the effective scope, computed before any model reasoning.
  3. Search mapping — a plan may only name a mapping belonging to a selected source.
  4. Field projection — returnable allowlist and restricted-field exclusion, applied at validation and again at response assembly.
  5. Record level — claim-derived parameterized predicates applied in the database query.
  6. Answer generation — gated per source and per effective response mode.
  7. Administrative configuration — the role area above.

Authorization Precedes All LLM Reasoning

An unauthorized source never appears in a prompt, a log, a diagnostic, an audit dimension or a response — including its existence. Source resolution filters by tenant, client application, capability binding, source policy, lifecycle state and health before any metadata reaches a model.

Selection output is validated against the candidate set that was supplied. A source id the model was not given is dropped and audited.


SQL Safety by Construction

model → structured intent → deterministic validation → provider query builder → parameterized SQL

The model never emits SQL. No value derived from a prompt, a model response or a caller claim ever reaches command text — such values travel exclusively as parameters. Relation and field identifiers come from configuration rows the validator already matched, and are emitted through the provider's identifier quoter.

Quoting is defense in depth, not the primary control: validation and quoting each hold on their own.

Each supported database engine has its own full-text query syntax, and the provider query builders use a conservative set of functions and query forms, so that content coming from a prompt or a caller's claims can never be interpreted as an operator or as structure within the query — only ever as a literal search term.


Record-Level Security

A source's record filter limits each caller to the records it admits. It is applied in the executed query itself, never as post-filtering in memory, and it is written as structured conditions:

  • each condition names a logical field of the source, an operator its type admits, and a value;
  • the value is written in the editor, or read from the caller's claim through a claim binding;
  • conditions are grouped under All of these hold or Any of these holds, and groups nest up to four levels.

The conditions are authored by an ESRA_DATA_MANAGE holder, versioned with the source, checked on save and at publication, and audited on change.

Nothing in a condition is ever query text. The field is resolved on each entity to that entity's own column, or to a constant the entity supplies. The operator comes from a closed set, and every value is a parameter of the field's type. So business_unit equals the caller's bu claim governs an entity whose column is BU and another whose column is business_unit, and compares dates as dates and numbers as numbers on every engine.

Field type Operators
Text, identifier equals, does not equal, ordering (>, ≥, <, ≤), is one of, is between, starts with
Number, date, instant the same, except starts with
Boolean equals, does not equal, is one of

A claim with several values compares as a set. A claim holding comma-separated values:

  • under equals or is one of, matches a record holding any of them;
  • under does not equal, matches a record holding none of them;
  • under any other operator, which needs one value, drops the source for that caller.

A claim with more than 500 values drops it too.

A missing claim is fail-closed. The query is not executed and the source is dropped with a warning. ESRA never substitutes a default and never omits a condition.

A record without a value never passes does not equal. On every engine, classification does not equal secret excludes a record that has no classification, as SQL excludes a null. A claim value that is not a value of its field's type (amount > "a lot") matches nothing.

An unresolved field is fail-closed too. An entity on which a condition's field cannot be resolved is withheld:

  • it is not searched;
  • a document fetch from it answers not-found;
  • the trace and audit record say RECORD_FILTER_UNRESOLVED and name the entity.

Nothing ever runs without its conditions.

Saving checks every condition and refuses with RECORD_CONDITIONS_INVALID, listing every problem at once:

  • a field that is not an enabled field of the source;
  • an operator its type does not admit;
  • the wrong number of values, or a value that is not one of its type;
  • a claim binding that does not exist;
  • more than 32 conditions;
  • a filter that reads no claim, and so cannot scope records to the caller.

The response allowlist and the masking rules are held to the field rule too, refused with GOVERNANCE_FIELD_UNKNOWN, because a rule over a field that does not exist governs nothing while reading as if it did. Governance and the fields it names are saved together in one change, so a field can be added and governed in the same save.

Governance that cannot be read is fail-closed. If a source's stored response allowlist or masking rules are damaged and cannot be read, the source is withheld from every caller. The trace says RECORD_FILTER_UNRESOLVED, and the runtime logs a warning that names the source but not the damaged content. The Portal shows a damaged list as empty, so re-enter the allowlist and masking rules and save them to restore the source. A masking rule whose kind is not recognised masks the whole value.

Templates written before structured conditions

Record filters written in 1.2 are free-text templates such as business_unit = @claim:bu. The upgrade converts every template whose meaning conditions can express exactly:

  • comparisons of a field with a claim placeholder or a literal written as its field's type;
  • IN, BETWEEN and LIKE 'prefix%';
  • AND, OR and parentheses.

A template the upgrade cannot convert is kept, and is still enforced. Examples are one calling a function, using NOT or IS NULL, or comparing a text column with a bare number. The upgrade's summary names each one with its reason, and the source shows the readiness warning ESRA_SOURCE_RECORD_FILTER_TEMPLATE.

A kept template can be kept or replaced, never edited. A save that resends it unchanged keeps it. Replace with conditions on Result governance clears it in favour of conditions. A new or changed template is refused with RECORD_FILTER_TEMPLATE_RETIRED.

While it stands, it depends on every field: no field of the source can be removed, renamed, disabled or retyped.

Governance protects its fields. While the record filter, the response allowlist or a masking rule uses a field, the field cannot be removed, renamed, disabled or given an incompatible type, and every entity keeps a binding for it. A template that cannot be read is treated as using every field.

A security-relevant remap needs confirming, and is audited. Two changes are refused until the operator confirms them (acknowledgeGovernanceChange):

  • rebinding, on one entity, a field the record filter reads from a column to a constant or a null;
  • making the record filter compare a field whose column a model writes, such as AISI's meta_* columns.

Once saved, each confirmed remap writes the audit action esra.source.governance-binding-changed. The record names the source, the entity, the field, and the old and new kinds of binding.

The Portal's source editor asks before the save is sent: it lists each such change by entity and field, and nothing is written unless you confirm. The editor's check is broad, so it may ask about a field name that appears only inside a quoted value of the filter. The server decides either way.

Sources created from an AISI index

AISI does not record who may open each document at the storage, so an AISI index is its own access boundary: anyone who can reach a capability over it can read every document in it. Scope such a source like any other, with the capability's access and record conditions over the index's fields, such as its path or container. AISI — who can read an index gives the rule.


Prompt-Injection Resistance

Retrieved database content is untrusted. It may contain text attempting to instruct the model.

Prompts use fixed structural separation — system instructions, then the request, then reference data, then the output contract — with reference data always last before the output contract, so the final instruction the model reads is ESRA's.

Untrusted content is wrapped in structural markers that identify where it begins and ends, each tagged to its specific result. Any occurrence of those markers already present in the retrieved content is stripped before insertion, so a malicious record can never forge a boundary of its own.

This is mitigation, not a guarantee, which is why every task's output is validated against an allowlist afterwards. The model boundary is the weakest link in the chain; the validators are the strong ones. Candidates are referenced by opaque per-invocation ids, so a model can never emit a record identifier it was not given.


What Is Never Sent to a Model

  • connection strings, hosts, ports, credentials, secret references;
  • relation names, schema names, physical column names not exposed as business fields;
  • restricted fields, or any field outside the returnable allowlist;
  • record filters, claim values;
  • unauthorized sources' metadata — including their existence;
  • other tenants' anything;
  • provider scores during reranking; raw provider errors or diagnostics anywhere;
  • prior invocations' content — each invocation is independent, there is no conversation state.

Multi-Tenancy

Enforced explicitly at every layer rather than assumed from the layer above. Every read of ESRA configuration is scoped to the tenant explicitly, with the platform's database-level tenant filter as a backstop.

  • Configuration — sources, capabilities and exposures are tenant-scoped; names are unique within a tenant; cross-tenant references are rejected in the domain and re-asserted at publication.
  • Runtime — the snapshot is keyed to the tenant and client application; the execution context carries the tenant from the authenticated request, so the core has no way to construct one for a different tenant.
  • Caching — results are cache-isolated per tenant, client application, capability and the caller's effective authorization, so a change in configuration or authorization invalidates the relevant cache entries automatically. A warm cache for one tenant never serves another.
  • Connections and secrets — secret references resolve within the owning tenant's scope; the outbound allowlist is consulted with the tenant id, so one tenant's allowlisted host does not become another's.
  • Audit and telemetry — the tenant dimension is present on every record, including failures and denials.

Output Safety

Field allowlist → masking → size cap → citation validation → error sanitization.

Never returned: SQL, connection details, credentials, stack traces, provider diagnostics, unauthorized fields. Provider exceptions become a closed set of classifications; the raw exception goes to logs only.

Anything unclassified becomes ESRA_INTERNAL with the detail logged and never returned.