Version 1.1 Picture guide

How ProcurAuth works

A picture guide for the author of a backend or of a service. Alice and her AI agent are the example. Read it before the specification.

1. Who manages what

ProcurAuth lets a backend manage the rights of its users and the rights of the AI agents that act for them. Alice is a user. She gives her agent a key.

Who manages what: the agent holds a key, the services speak AuthZEN, the backend manages the rightsAlice's agent holds only a key and shows it to the edge. The edge gives the service an identity token. The service, which holds a PEP, asks the PDP in AuthZEN. The PDP is part of the backend. The backend holds the users and their rights, the grants and limit values, the keys and the counters of the budgets.The agentThe front of your servicesYour backendAlice's agentholds only a keyand shows it tothe edgeEdgechecks the key,gives a signed tokenService (PEP)speaks AuthZEN,asks for each call,applies the answerPDPdecides, counts the budgetsUsers and their rightsGrants and limit valuesKeys: make and revokeCounters of the budgetskeytokenAuthZENquestion
Who manages what: the agent holds a key, the services speak AuthZEN, the backend manages the rightsAlice's agent holds only a key and shows it to the edge. The edge gives the service an identity token. The service, which holds a PEP, asks the PDP in AuthZEN. The PDP is part of the backend. The backend holds the users and their rights, the grants and limit values, the keys and the counters of the budgets.Alice's agentholds only a keykeyEdgechecks the key, gives a signed tokentokenService (PEP)speaks AuthZEN, applies the answerAuthZEN questionYour backendPDPdecides, counts the budgetsUsers and their rightsGrants and limit valuesKeys: make and revokeCounters of the budgets
Figure 1. The agent holds only a key. The services speak AuthZEN. The users, the grants and limit values, the keys and the counters of the budgets are in the backend, with the PDP.
  • Alice's agent holds only the text of a key. It never holds a right.
  • The edge checks the key and gives the service an identity token.
  • The service holds a PEP. It speaks AuthZEN: it asks the PDP for each call and applies the answer.
  • Your backend holds the rights. When Alice changes a right or revokes the key, the services change nothing.

Rules: 1.1, 2, 3.8.

2. The roles

Four parts take part in a call of Alice's agent. Your service is one of them.

The four roles: agent, edge, service with its PEP, and the PDPThe agent talks to the edge. The edge talks to the service. The service asks the PDP, which decides.AgentAn AI program thatuses a key.It is not a subject.EdgeChecks the key.Gives the service asigned identity token.Service (PEP)Asks the PDP.Acts, or refuses.Applies the ceilings.PDPThe decision point.Decides for the subject.Counts the budgets.your service
The four roles: agent, edge, service with its PEP, and the PDPThe agent talks to the edge. The edge talks to the service. The service asks the PDP, which decides.AgentAn AI program thatuses a key.It is not a subject.EdgeChecks the key.Gives the service asigned identity token.your serviceService (PEP)Asks the PDP.Acts, or refuses.Applies the ceilings.PDPThe decision point.Decides for the subject.Counts the budgets.
Figure 2. The four roles. The service holds a PEP, a policy enforcement point. The PDP is the policy decision point.

The edge stands in front of the service. The service accepts requests only through the edge. The PDP decides. The service never decides alone.

Rules: 1.3, 2.

3. The flow of one call

One call has five steps. Follow the numbers in the figure.

The flow of one call in five numbered stepsTime goes from top to bottom. Step 1: the agent shows its key to the edge. Step 2: the edge gives the service a request with an identity token and no key text. Step 3: the service asks the PDP. Step 4: the PDP answers yes or no, with limits. Step 5: the service acts or refuses, and the result goes back to the agent.Alice's agentEdgeService (PEP)PDP1Key text in theAuthorization header2Request + identity token,key text removed3Can this subject dothis action here?4Yes or no,with limits5Acts, or refuses(the result goes back to the agent)
The flow of one call in five numbered stepsTime goes from top to bottom. Step 1: the agent shows its key to the edge. Step 2: the edge gives the service a request with an identity token and no key text. Step 3: the service asks the PDP. Step 4: the PDP answers yes or no, with limits. Step 5: the service acts or refuses, and the result goes back to the agent.1Agent to edgeShows its key.2Edge to serviceChecks the key. Gives a token.3Service to PDPCan this subject do this action?4PDP to serviceYes or no, with limits.5ServiceActs, or refuses.
Figure 3. One call of Alice's agent, in five numbered steps. Time goes from top to bottom.
  1. The agent of Alice shows its key to the edge, in the Authorization header.
  2. The edge checks the key. It gives the service a signed identity token. The key text does not go on.
  3. The service asks the PDP: can this subject do this action on this resource?
  4. The PDP answers yes or no. A yes can carry limits.
  5. The service acts, or it refuses.

The service sends only the subject id to the PDP. It never sends the text of the key.

A route that runs no action of the action document, for example a static file, asks the action access on the service. A health-probe route needs no token and asks no question.

The PDP can also ask for the approval of the owner before an action runs. The service then runs nothing until the owner approves. The MCP binding tells how a tool waits for the approval.

Rules: 9.1, 9.6, 10.0, 10.1c, 10.3, 17.7.

4. A key never has more than its owner

A key is a subject. It acts for a person, its owner. Alice makes a key for her agent. The key has its own grants.

The PDP answers yes for a key only when two things are true. A grant of the key gives the action and covers the resource. The owner has that right now.

A key keeps only what its owner also hasAlice has read on test1, read on test2 and write on test2. Her key has the same three grants and also write on test1. The result is the grants that are in both lists: read on test1, and read and write on test2. Write on test1 is dropped.Alicethe ownerdata.read on test1data.read on test2data.write on test2The keykey:9b1c04e2aa71f0c3data.read on test1data.read on test2data.write on test2data.write on test1droppedWhat the key can doonly what both lists givedata.read on test1data.read on test2data.write on test2∩=
A key keeps only what its owner also hasAlice has read on test1, read on test2 and write on test2. Her key has the same three grants and also write on test1. The result is the grants that are in both lists: read on test1, and read and write on test2. Write on test1 is dropped.Alicethe ownerdata.read on test1data.read on test2data.write on test2∩The keykey:9b1c04e2aa71f0c3data.read on test1data.read on test2data.write on test2data.write on test1dropped=What the key can doonly what both lists givedata.read on test1data.read on test2data.write on test2
Figure 4. Alice and the key of her agent (an example). Both lists give read on test1 and read and write on test2: the key keeps them. Only the key has write on test1: it is dropped.

When Alice loses a right, her agent loses it too. The PDP copies no right. It checks the owner at each decision. A kept answer in the service can delay this by cache_ttl at most.

Rules: 3.5, 8.4.

5. Coverage

The resources of a service form a tree. In the example, the types are host, database and table. Each resource has a chain of ancestors, from the service down.

A grant on a node covers the node and each node below it. This includes a node that the service adds later. A grant never covers a node above it.

A grant on the host covers the host and everything below itThe grant G is on the host prod. It covers the host, the databases test1 and test2, their tables, and a database added later. It does not cover the service.A grant on the host prodservice datastorehost prodGdatabase test1table usersdatabase test2table ordersdatabase new_dbadded later
A grant on one database covers only that database and its tablesThe grant G is on the database test2. It covers test2 and its table orders. It does not cover the host, the database test1 or a database added later.A grant on the database test2service datastorehost proddatabase test1table usersdatabase test2Gtable ordersdatabase new_dbadded later
  • G: the grant
  • covered
  • not covered
  • added later
Figure 5. Coverage in a tree of service, host, database and table. Left: a grant on the host covers a database that the service adds later. Right: a grant on one database covers only that database and its tables.

To give her agent two databases only, Alice gives one grant on each of them. The service builds the chain from its own data. It never takes the chain from a client.

Rules: 4.1, 4.3, 4.5.

6. Limits: ceilings and budgets

A grant can carry limit values, so Alice can bound her agent. A limit has a kind: a ceiling or a budget. The two kinds work in different places.

A ceiling: the service stops a use at 30 secondsThe ceiling max_duration is 30. A use runs for 30 seconds. At 30 seconds the service stops it. A longer run does not happen.CeilingThe service applies it.max_duration = 30One call of the agent runsnot allowed0 s30 sThe service stopsthe use here.The PDP gives the value incontext.limits of its answer.
A budget: nested counters of an owner and of its keyOne use asks for one unit. The PDP takes one unit from each counter: the counters of the owner, 10 a second and 300 a minute, and the counter of its key, 100 a minute. If one counter is empty, the PDP takes none.BudgetThe PDP counts it.1 call asks 1 unitCounters of the owner (alice)10 per second3 units left300 per minute120 units leftCounters of its key100 per minute41 units leftAll counters have units: the PDP takes one from each,and the answer is yes. If one is empty, it takes none.
Figure 6. Left: a ceiling, applied by the service. Right: a budget, counted by the PDP. The key of the agent has its own counters. Alice has counters too, and they bound each call of the agent.
PropertyCeilingBudget
Examplemax_duration = 30 s10 per second and 300 per minute
What it boundsOne useMany uses, over time
Who applies itThe serviceThe PDP, which counts
In the answerThe value, in context.limitsNo value. The answer shows the units that the PDP took.
When it stops a callThe service stops the use at the value.The PDP answers no, with budget_exceeded and retry_after, the seconds to wait.

A budget has one to four windows: second, minute, hour or day. Each window has its own counter. A use takes one unit from each counter, or from none. The service maps the refusal to HTTP 429, with Retry-After.

Rules: 6.1, 6.5, 6.7, 7.1, 8.1, 10.3.

7. The identity token

The edge gives the service a short signed token for one subject, here the key of Alice's agent. The token is a JWT. The service checks the signature, the issuer, the audience and the times.

The claims of an identity token for a keyThe token has the claims iss, sub, aud, iat and exp, and owner for a key, and a signature made with Ed25519 or ES256. The token carries no grant, no limit and no decision.Token for the key of Alice's agentissedge.examplewho signed the tokensubkey:9b1c04e2aa71f0c3the subject: here, the keyauddatastorethe service that may use itiat1792569600time of issueexp1792569900time of end, 300 s laterowneralicethe owner, for logs and approvalssignaturemade with Ed25519 or ES256The token carries:✕ no grant✕ no limit✕ no decisionA decision comes onlyfrom the PDP.
The claims of an identity token for a keyThe token has the claims iss, sub, aud, iat and exp, and owner for a key, and a signature made with Ed25519 or ES256. The token carries no grant, no limit and no decision.Token for the key of Alice's agentissedge.examplewho signed the tokensubkey:9b1c04e2aa71f0c3the subject: here, the keyauddatastorethe service that may use itiat1792569600time of issueexp1792569900time of end, 300 s laterowneralicethe owner, for logs and approvalssignaturemade with Ed25519 or ES256The token carries:✕ no grant✕ no limit✕ no decisionA decision comes only from the PDP.
Figure 7. The claims of the identity token of the key of Alice's agent. A token for a person has no owner, and its sub is the id of the person.
  • The token has no grant, no limit and no decision.
  • The service sends only sub to the PDP.
  • The service never uses owner in a decision. It is for logs and approvals.
  • The service refuses a token that has a bad signature, a bad issuer, a bad audience or a bad time.
  • The times iat, exp and the optional nbf are JSON integers with digits only. The service refuses a fraction, an exponent or a sign.
  • When the edge has more than one signing key, each token has kid. The service then refuses a token without kid.

Rules: 9.2, 9.3, 9.4, 9.5, 9.7.

8. The action document and the options route

A service publishes two documents. Both are below the same well-known path. A system that shows Alice a form for grants reads them.

The two documents of a service and their pathsThe action document is at /.well-known/procurauth/actions and needs no login. The options route is at /.well-known/procurauth/resources and needs an identity token.Action document/.well-known/procurauth/actionsSays what the service offers:its types, its actions and its limits.One document for the whole service.Anyone can read it. No login.Options route/.well-known/procurauth/resourcesLists the children of a node, for a form.One page at a time, with a search.Shows only what the subject can see.Needs an identity token.
The two documents of a service and their pathsThe action document is at /.well-known/procurauth/actions and needs no login. The options route is at /.well-known/procurauth/resources and needs an identity token.Action document/.well-known/procurauth/actionsSays what the service offers:its types, its actions and its limits.One document for the whole service.Anyone can read it. No login.Options route/.well-known/procurauth/resourcesLists the children of a node, for a form.One page at a time, with a search.Shows only what the subject can see.Needs an identity token.
Figure 8. The two documents of a service, with their paths.

The action document

The service publishes it at /.well-known/procurauth/actions, with no login. It is a JSON object. These members are mandatory: server, resource_types and actions. The members resources and limits are optional.

  • server is the id of the service. It equals the aud of the tokens.
  • resource_types is the tree of types. Each item has name, parent and description.
  • actions lists each action with name, resource_types, description and limits.
  • limits declares each limit with name, label, description, unit and kind. A ceiling also has min and max.
Action document of the service datastore
{  "server": "datastore",  "resource_types": [    {      "name": "host",      "parent": "service",      "description": "One database server."    },    {      "name": "database",      "parent": "host",      "description": "One database."    },    {      "name": "table",      "parent": "database",      "description": "One table."    }  ],  "actions": [    {      "name": "data.read",      "resource_types": [        "service",        "host",        "database",        "table"      ],      "description": "Read data.",      "limits": ["requests", "max_rows", "max_duration"]    },    {      "name": "data.write",      "resource_types": [        "service",        "host",        "database",        "table"      ],      "description": "Change data.",      "limits": ["requests", "max_duration"]    }  ],  "resources": [    { "path": "host:prod", "label": "Production" }  ],  "limits": [    {      "name": "requests",      "label": "Requests",      "description": "Requests that run.",      "unit": "request",      "kind": "budget"    },    {      "name": "max_rows",      "label": "Most rows",      "description": "The most rows that one read gives.",      "unit": "rows",      "kind": "ceiling",      "min": 1,      "max": 1000000    },    {      "name": "max_duration",      "label": "Longest run",      "description": "The longest run of one use, in seconds.",      "unit": "seconds",      "kind": "ceiling",      "min": 1,      "max": 600    }  ]}

Check a document like this one with access-lint. Rules: 5.1, 5.2, 5.3, 6.1.

The options route

A form where Alice gives grants to her agent needs a list of choices. The route /.well-known/procurauth/resources lists the children of a node. The request has these query parameters:

  • parent: optional. The path of the node, for example host:prod.
  • type: mandatory. The type of the children.
  • q: optional. A search text.
  • limit: optional. The most items to give.
  • after: optional. The value of next from the last answer.

The caller encodes each value in percent form. Thus host:prod is host%3Aprod.

Request
GET /.well-known/procurauth/resources    ?parent=host%3Aprod    &type=database    &q=test    &limit=2
Answer
{  "items": [    {      "id": "test1",      "label": "test1",      "has_children": true    },    {      "id": "test2",      "label": "test2",      "has_children": true    }  ],  "next": null}

The databases of the host prod whose names hold test, two at a time. The value next is null on the last page. Rules: 5.6, 5.7, 5.8, 5.9.

9. Glossary

Action
What a subject does, for example data.read.
Action document
The document in which a service declares its types, actions and limits.
Agent
An AI program that uses a key. It is not a subject.
Backend
The system of the operator. It holds the users, their rights, the keys of their agents and the limit values, and the PDP decides from this data.
Budget
A limit that gives units for one or more windows. The PDP counts it.
Ceiling
A limit on one use, for example max_duration. The service applies it.
Chain
The ancestors of a node, from the service down.
Counter
The units that one subject spent on one window of a budget.
Coverage
The rule that a grant on a node covers the node and each node below it.
Edge
The part in front of a service. It checks the key and gives the identity token.
Grant
A right to do an action on a resource. It can carry limit values.
Identity token
A short signed token that the edge gives a service for one subject.
Key
A subject that acts for a person. It never has more rights than its owner.
Options
The children of a node that a service lists for a form.
Owner
The person for whom a key acts.
PDP
The decision point. It answers yes or no, and it counts budgets.
PEP
The part of a service that asks the PDP and applies the answer.
Resource
A node in the tree of a service: the service, a host, a database or a table.
Service
The application that holds a PEP. It is the root of its tree.
Subject
A person or a key. A key id has a colon, for example key:9b1c04e2aa71f0c3.
Window
The fixed period of a counter: second, minute, hour or day.