Trust
Security
Sefra holds write credentials for your systems of record, so it has to be judged as a target. This page says where the credentials are, what happens when something fails, what is stored, and what is not done yet.
Sefra holds no certification, and using it does not make a deployment compliant with any regulation.
The architecture
Sefra is one binary that you run in your own network, with PostgreSQL and Temporal beside it. One deployment serves one organisation.
Your deployment and connected services
- Your AI agentsAny MCP client, or plain HTTP.
- ApproversThe approval page, or the operator API and CLI.
- OperatorsThe console, the CLI and scripts.
Sefra
- AuthenticationJWT check
- Admissionpause, suspend, rate limit
- Grantsrole to intents
- Idempotencykey and fingerprint
- Input schematyped validation
- PolicyOPA, Rego, live facts
- Acceptstate and audit, one transaction
- Approval escrowby role
- Steps and connectorsTemporal, Sefra's credentials
- Compensationreverse order
Audit trail: every step, hash-chained, committed before any write to a system of record.
- Systems of recordReached with Sefra's service credential.
- Secret managerOpenBao, or mounted files.
- Identity providerIssues the tokens and signs people in.
- NotificationsA signed webhook to your receiver, if you turn it on.
Once you revoke the agents' own credentials, no direct path from an agent to a system of record.
Runs beside Sefra
- PostgreSQLState and audit
- TemporalDurable runs
- OpenTelemetry collectorYours, optional
- A connector is the only code path that reaches a system of record. It calls only its configured base URL and, for OAuth, its configured token URL, and it follows no redirect.
- The gate holds only once the agent's own credentials for those systems are revoked. That is a required deployment step, and until it is done the agent can go around Sefra.
Where the credentials are
- Sefra calls each system with its own service credential. Agent tokens are never forwarded.
- A connector's credential is a reference to a secret manager, a mounted file or, for development, an environment variable. It is resolved at run time. OpenBao is the only secret manager type supported.
- A resolved value is cached for 5 minutes by default. After that, a value that cannot be read is not reused, and the request is not sent.
- You scope each credential in the system of record to exactly the operations of the active bundle. Sefra does not check that scope.
- Agents and operators call the API with tokens from your identity provider, and issuer, audience, expiry and signature are checked on each of those calls. People on the approval page and console sign in with OpenID Connect and then hold a session. Health checks and OAuth metadata need no token.
- The system of record sees Sefra's service account as the actor. The link from a change to the agent, the user and the approver is in the audit trail.
Fail closed
If a schema, a fact, the policy engine or the audit store is unavailable, the request is refused. No write reaches a system of record before its audit record is committed. Facts are read first and recorded with the decision.
| Failure | Result | Effect |
|---|---|---|
| A fact cannot be read | FACT_UNAVAILABLE | Rejected at submission. At step time the step fails and earlier steps are undone |
| Policy evaluation fails | POLICY_ERROR | A denial, recorded with the error |
| No policy allows the intent | Denied | Allow must be true, positively |
| A bundle does not compile or its tests fail | Refused | The previous bundle stays active |
| The audit write fails | Nothing proceeds | Before a call: the state change fails and the system is not called. After a call: the write is retried and the workflow waits, so nothing proceeds unrecorded |
| A connector secret is missing | DOWNSTREAM_UNAVAILABLE | The request is not sent. During a fact read the code is FACT_UNAVAILABLE |
| PostgreSQL is down | Nothing accepted | No step starts and no approval is decided |
| The identity provider is down | Refused once tokens expire | Sefra keeps using the signing keys it last fetched, so tokens already issued work until they expire. With no cached keys, requests are refused |
No model in a decision path
- Validation, policy, approval matching, retries and compensation are deterministic code and data. No model takes part in a decision.
- Policy evaluation receives a document and returns a document. It performs no I/O and reads no clock except the one injected.
- The record of a decision holds the hash of the policy input, the bundle digest and the injected time. The input is kept as an audit payload, so a replay can evaluate the decision again while that payload exists.
What data Sefra keeps
Sefra is not a system of record. It keeps short-lived working copies and longer-lived evidence copies in your own database and Temporal service. If you turn on the webhook, each approval's summary lines also go to the receiver you configure, with marked fields redacted.
| Data | Where | How long | Form |
|---|---|---|---|
| Audit events | PostgreSQL | Indefinitely, by default | Hash-chained, with hashes of payloads |
| Audit payload bodies | PostgreSQL | Until you delete them. A 13-month default is planned | Marked fields are keyed hashes. Agent rationale and approval comments are stored as written |
| Step inputs | PostgreSQL | 7 days after the final status | Real values, including marked fields, which the approval page shows |
| Step outputs | PostgreSQL and Temporal history | 30 days in PostgreSQL. In Temporal, the namespace retention your deployment sets (7 days in the reference deployment) | Real values of the fields the manifest names |
- Audit events hold hashes of request and response payloads, not the payloads. They do hold policy decisions with their messages and operators' notes as written, and the chain covers those. A schema field marked
x-sefra-sensitiveis replaced by a keyed hash (HMAC-SHA256, with a secret per deployment) before it is stored in the audit copy. - Protection applies to fields marked in the schema. An unmarked field is stored as written, so marking fields is part of reviewing a bundle.
- Audit payload bodies are kept until you delete them. A 13-month default is agreed, but no job enforces it yet and there is no erase command. Deleting a body needs the table owner's database role. The chain survives that, because it covers only the hash, but a replay cannot evaluate a decision whose input is gone.
No telemetry to us
- Sefra reports nothing to us and opens no inbound route for an outside service. It calls only destinations you configure: your systems of record and their token endpoints, identity provider, secret manager, PostgreSQL and Temporal, and, if you turn them on, webhook receivers and an OpenTelemetry collector.
- Operational telemetry goes only to the OpenTelemetry collector you configure. Leave the endpoint unset and nothing is sent.
- It carries ids, including principal ids, statuses, error codes, counts, durations, protocol fields and Sefra's own log and error messages. It is built to exclude step values, rationale, idempotency keys, approval comments, tokens and secrets, and an automated check searches for them.
How the audit trail is verified
- The verifier recomputes the hash chain. If the chain is broken, it names the first bad sequence number and exits non-zero.
- It reads PostgreSQL directly and not through the service, so the service cannot filter or substitute what it checks. It cannot detect false events that a compromised service appended through its own role, because those are validly chained.
- The verifier can also recompute the chain of an exported file without the database, so an auditor needs no database access. The hashes have no key, so this shows the file is consistent, not that it is genuine or complete. Compare its last hash with a head hash you stored separately for that sequence number.
- When Sefra runs as the
sefra_appdatabase role, as documented, it can insert and read audit events but cannot update or delete them. A deployment that runs Sefra as the table owner loses this protection. - Someone with full control of the database can still rewrite the whole chain. Until that is closed, keep the current head hash where that person cannot reach it.
What is planned
- Anchored audit checkpointsPlannedExternally anchored, signed audit checkpoints.
- Signed bundlesPlannedSigned bundles and two-person activation.
- Payload retention and erasurePlannedPayload retention and erasure that keep the chain intact.
- Threat model and penetration testPlannedA written threat model and an external penetration test, both planned ahead of general availability.
- Per-user credentialsPlannedPer-user downstream credentials.
Reporting a vulnerability
Report a vulnerability to the address below. It is also in /.well-known/security.txt.