Skip to content

Connector credentials: what each one must be allowed to do

Sefra calls a system of record only through a connector, with Sefra’s own service credential for that system. Sefra holds write credentials for several systems and is therefore a target in itself. Scope each credential in the system of record to exactly the operations the active bundle’s manifests call, and to nothing else. Sefra does not check the scope: it is configured in the system of record.

For each connector of connectors.yaml, the credential (the static secret, or the client of oauth_client_credentials) must be allowed:

  • every execute operation of the manifests that use the connector;
  • every compensate operation: a credential that can create but not cancel turns every rollback into needs_intervention;
  • every probe operation: without it an ambiguous answer cannot be settled;
  • every fact read (facts), including those of manifests whose execute goes to another connector;

and nothing beyond them: no other paths, no administration, no bulk export, no user management. The agent never holds this credential, and only Sefra uses it.

Go through the manifests whenever a bundle changes. A new intent, a new fact or a new compensation can need a new permission. A removed one should take its permission with it.

Further:

  • Separate credentials per environment and per Sefra deployment. A client secret or token is never shared with another application, and never given to an agent.
  • Client credentials. Prefer oauth_client_credentials where the system supports it. Its tokens expire, and the client secret is sent only to the token endpoint. Give the client the scopes that cover the operations above, and set them as scope in connectors.yaml.
  • The secret manager’s own token for Sefra reads only the paths of Sefra’s secrets (in OpenBao or Vault, a policy with read on <mount>/data/<path> of those secrets only).
  • Rotation. Sefra reads a secret again after timings.secret_refresh (default 5 minutes) and on a 401 from a client-credentials token. Rotate by writing the new value, waiting that long, then revoking the old one at the system of record.
  • Bypass. The system of record must refuse every other caller that could act on the agent’s behalf, the agent’s own credentials included.

An example connector, erp, fronts a procurement system. Its credential, the client sefra-erp, must be allowed exactly these operations:

Operation Used by As
GET /budgets/{department} procurement.get_budget; procurement.create_purchase_order execute; fact budget
GET /vendors/{id} procurement.create_purchase_order fact vendor
POST /purchase-orders procurement.create_purchase_order execute
POST /purchase-orders/{id}/cancel procurement.create_purchase_order compensate
POST /vendors procurement.create_vendor execute
GET /vendors/by-tax-id/{tax_id} procurement.create_vendor probe
POST /vendors/{id}/deactivate procurement.create_vendor compensate
POST /payments procurement.pay_deposit execute

How you express this scope depends on your ERP’s own permission model.