Version 1.1
The changelog in docs/ of the repository gives the changes of each version.
A paragraph keeps its number in later versions. A paragraph that leaves this document keeps its number, with the word "Unused" and a pointer. A new paragraph gets a new number, or a letter after the number of the paragraph that it continues. The numbers 7.2, 7.7, 8.5, 10.4 and 10.5 stay unused.
This document defines the ProcurAuth protocol, a profile of the AuthZEN Authorization API 1.0 [AUTHZEN]. It names no product, and any product can use it.
The words MUST, MUST NOT, SHOULD and MAY have the meaning of [RFC 2119] and [RFC 8174].
1.Introduction
This protocol adds four things to AuthZEN 1.0:
This protocol changes no member of the core. It uses properties, context, the action document (section 5) and the identity token (section 9). A receiver of AuthZEN 1.0 ignores a member that it does not know [AUTHZEN 1.0, l.1418]. A PEP of this protocol MUST understand each member that this protocol marks as mandatory. This protocol is the only normative text for the subject, chain, coverage, action document, list of the options, identity token, limits and reasons. Other documents refer to its paragraphs and do not restate them.
A PDP conforms to this protocol when it follows sections 3 and 4, 5.1 to 5.5, sections 6 to 8, 10.7, 10.7a, 10.7b, 11 and 12. A service (its PEP) conforms when it follows these paragraphs:
- 3.3, 3.4, 4.1, 4.4 and 4.5;
- 5.1, 5.2, 5.2a, the last sentence of 5.3c, 5.4, 5.5 and 5.5a, and 5.6 to 5.8 when it publishes the list of the options;
- 5.2b;
- 6.1, 6.2, 6.4, 6.11 and 6.12;
- 7.1 and 7.3 to 7.6;
- the last sentence of 8.3;
- 9.3 to 9.7, 10 and 11.
An edge conforms when it follows 1.4, 8.3, 9.1 to 9.3, the second paragraph of 9.4, 9.8 and 9.9. The system that makes keys follows 3.2 and 3.8 for this job. A caller of the route of 5.6 follows 5.6 to 5.9. A service with an MCP endpoint, and an edge in front of such a service, also follow the MCP binding [MCP-BINDING].
Section 17 is mandatory for a service. A service follows these paragraphs for each action: 5.2b, 17.1 to 17.4, 17.7, 17.7a, 17.9, 17.9a and 17.12. It has no way to opt out for an action. A service that cannot follow these paragraphs for an action does not conform.
A PDP that gives approvals also follows 17.1 to 17.6 and 17.8 to 17.12. A PDP MAY give no approval. It then never answers a reason of 17.1. For a question that a grant with confirm covers, it answers false with no reason (11.2). An edge follows the last sentence of 17.8.
A PDP MAY serve built-in actions of its own system, for example the functions of a portal. It gives them to a reserved service id that no other service uses. These actions have no PEP and no action document. Paragraphs 1.3 and 5.2b and section 17 do not apply to them. The PDP MUST refuse confirm on a grant of such an action, because no PEP can wait for an approval. The reserved id is not a service of this protocol.
In this version, an agent sends the text of its key to the edge in the header Authorization: Bearer [RFC 6750, 2.1]. This version is for local clients that can send this header. A hosted client, which runs on the servers of a third party, is not in this version. This version defines no OAuth flow. A later version can add an OAuth server at the edge. The identity token of section 9 then does not change.
2.Terms
The words PDP, PEP, subject, action, resource and evaluation have the meaning of [AUTHZEN]. Other words have the meaning of this list or of the section that defines them.
- Person: a human subject. Its id has no colon (3.1).
- Key: a subject that acts for a person, its owner (3.4). Its subject id (3.2) has a colon and is not secret. A key also has a secret text, the text of the key, which an agent sends to the edge (1.4). A question names a key by its subject id and never holds the text of the key (9.3). A key is not a token. A key that a service checks by itself (no edge) and the signing key of the edge (9.2, 9.4) are not keys of this protocol.
- Owner: the person for whom a key acts.
- Agent: a program that uses a key. An agent is not a subject: the PDP decides for the key.
- Edge: the part in front of a service that authenticates a client and gives the identity token to the service. It can be a proxy and its authentication server.
- Service: the application that holds a PEP. Its id is the id of the root node, of type
service, and the memberserverof its document. - Node: the service, or a resource below it in the tree of the types of the service (5.2).
- Chain: the ancestors of a node, from the service down, in
resource.properties.ancestors(4.1). - Coverage: the rule of 4.3: a grant on a node covers the node and each node below it.
- Action document: the document in which a service declares its types, its actions and its limits (section 5).
- Options: the children of a node that a service lists for a form (5.6).
- Identity token: the token that an edge gives a service for one subject (section 9).
- Directory: the subjects, the grants and the limit values on which a PDP decides. 3.9 bounds the age of a copy of it.
- Question: one evaluation that a PEP sends to the PDP.
- Kept answer: an answer that a PEP keeps for at most
cache_ttl(10.1). - Grant: a right to do an action on a resource. A grant can carry limit values.
- Limit: a number that bounds the uses of an action. Its kind is
ceilingorbudget. - Ceiling: the maximum of one use, for example the most rows that one read gives. The PEP applies it.
- Budget: a limit that gives an amount of units for each of one or more windows (6.1). The PDP counts it.
- Counter: the units that one subject spent on one budget in the current window. Each window of a budget value has its own counter (6.7). Only the PDP knows the counters.
- Window: the fixed period in which a counter counts (6.3). The member
windowof an item of a budget value gives its length (6.1). - Amount: the units that a grant gives to a budget for one window.
- Units: the quantity that one use takes from a budget, as a number in the unit of the budget, in
context.usage.units(6.4). - Unit: the unit of measure of a limit, which the member
unitof its declaration names (6.1). Examples:requestfor the budgetrequests,rowsfor the ceilingmax_rows(6.1). - Operation: one request that a client sends to a service. An operation can ask several questions.
- Use: one run of an action that a service does for one operation. A use takes units from budgets. A question to the PDP is not a use. A question for a display, for example to choose the options of 5.6, is not a use.
- ttl: the life of an item that the system makes and renews, for example an identity token or a kept answer (10.1).
3.Subjects
A key has the subject id <prefix>:<local>. This protocol defines the prefix key. The local part has 1 to 64 characters from a to z, 0 to 9, underscore and hyphen. It is the id of the key in the system that makes the key. Example: the subject id key:9b1c04e2aa71f0c3 has the local part 9b1c04e2aa71f0c3.
The PEP sends the subject with the type user, for a person and for a key. The id is the sub of the identity token. The PEP MUST treat the id as opaque text. The PEP MUST NOT read a meaning from its characters. A subject of another type is an unknown subject (11.1).
The PDP knows the owner of each key. The PEP does not send the owner (9.6).
The PDP answers true for a key only when two conditions are true at that moment. A grant of the key gives the action and covers the resource (4.3). The owner has the right to do that action on that resource. This protocol does not say how the PDP decides the current rights of the owner. A grant of the key that the rights of the owner do not cover gives nothing. The decision for a key follows this paragraph only.
When the owner loses a right, the key loses it at the first decision of the PDP after the PDP has the change. A kept answer of the PEP can delay this by cache_ttl at most (10.1). The PDP copies no right.
A PDP MAY need other conditions of the owner. Examples are the right to have keys, and a maximum life of a key that the rules of the owner set. When a condition fails, the answer is false with no reason (11.2). It is never unknown_subject, because the condition can change later.
Unused.
An id with a colon and an unknown prefix, or a bad local part, is an unknown subject (11.1).
Each key is one subject. The grants and the limit values of a key are its own. The system that makes a key chooses the local part of its subject id (3.2) and the format of its text. This protocol defines no format for the text of a key. When the system revokes or deletes a key, or when a key expires, the key is an unknown subject (11.1). A condition of 3.5 that can change later never makes a key unknown.
A PDP that decides from a copy of its directory MUST bound the age of that copy. It MUST answer false for each key when the copy is older than the bound. The PDP publishes the bound in whole seconds, in the metadata member procurauth_directory_max_age_seconds (10.7b). A PDP that decides from its directory itself, with no copy, publishes 1.
4.Resources and coverage
A resource has a type and an id. The PEP sends the most specific node that the operation uses. The service itself is the resource of type service, with the id of the service. It has no ancestors, or an empty array.
A resource below the service MUST carry the chain of its ancestors in resource.properties.ancestors. The chain is an array of objects with type and id, from the service to the parent of the resource, in this order. The first object is the service, and the chain does not hold the resource.
The types of the chain, then the type of the resource, follow the parents of the action document (5.2). The depth of a type is the number of steps from service to it: a type with the parent service has the depth 1. The maximum depth is 4. An id is an exact string of 1 to 256 bytes in UTF-8, with no control character. The PEP does not encode it.
An id is unique only below its parent. Two parents can have a child with the same id.
A grant on a node covers the node and each node below it, also a node that the service adds later. A grant on a database does not cover its host. Example, with the service and the notation of section 13: a grant of data.read on service:datastore/host:prod covers each database of this host, now and later. To give two databases only, give one grant on each of them. Alice in section 13 has no such grant, so her grants do not cover the host.
The request can carry context.match. The value node is the default: the answer is a decision about the node. The value subtree asks if a grant applies on the node, above it or below it. A true answer for subtree is for the display only. A PEP MUST NOT let an operation run because of it.
For a key, a true answer for subtree needs one node that a grant of the key and a right of the owner both cover (3.5). This node is the node of the question, a node above it or a node below it. The next example uses the databases test1 and test2 of section 13. A key with data.read on test2, and an owner with data.read only on test1, gets false for data.read with subtree on the service.
The PEP builds the chain from its own data. It never takes the chain from a client.
5.The action document and the list of the options
A service publishes its document at /.well-known/procurauth/actions, without authentication.
The document is a JSON object with these members:
server: the id of the service. It is equal to theaudof the identity tokens of the service;resource_types: the tree of types below the service. Each item hasname,parentanddescription. A description has 1 character or more. A type name has 1 to 32 characters: a to z first, then a to z, 0 to 9 or underscore. A type name is notserviceand occurs one time. Theparentisserviceor another declared type, with no cycle and a depth of 4 at most (4.1). The typeserviceis the root, and the document does not declare it;actions: each withname,resource_types,descriptionandlimits. A description has 1 character or more. A name has 1 to 64 characters: parts of a to z, 0 to 9 and underscore, with.between the parts.resource_typesgives the types on which a grant of the action is valid:serviceor declared types, each one time.limitsis optional: it gives the names of the limits of the action (6.2). A limit name that the document does not declare, or a name that occurs more than one time, makes the document bad (5.3). The list never has the actionaccess, which opens the service to a subject (8.3). An action name occurs one time in the document;resources: optional, the nodes that the service names, each withpath, and optionallylabelandactions.pathis<type>:<id>segments with/between them, and the path does not hold the service. Each segment has a type whose parent is the type of the segment before it, orservicefor the first segment (4.1). The service percent-encodes each id: each byte outside A-Z, a-z, 0-9,-,.,_and~becomes%XX, with upper-case hexadecimal digits [RFC 3986]. This is the only text form of an id. Withoutactions, the item takes each action that lists its type. Inactions, an action name that the document does not declare, or a name that occurs more than one time, makes the document bad (5.3). An action that does not list the type of the last segment ofpathin itsresource_typesalso makes the document bad;limits: optional, the limit declarations of the service (6.1). A limit name has 1 to 32 characters: a to z first, then a to z, 0 to 9 or underscore.
A service publishes only the actions that it serves. An action of a feature that the configuration of the service turns off is not in actions, and the service sends no question for it. A service that serves an action for some of its hosts or settings publishes the action when it serves it for at least one of them. When the feature turns on, the service publishes the action again with the same name and the same resource_types. The reader finds it at its next read (5.3b).
Each action of the document follows section 17. An action has no member approval, and no flag lets a service skip section 17 for an action. A service MUST NOT publish the member approval. A reader ignores it as an unknown member (5.3), and it never makes a service skip section 17. The PDP decides which uses need an approval, with the member confirm of a grant (17.8).
The reader checks the document. A bad member, or an unknown member of a limit declaration, makes the whole document bad.
A read fails when it gets a status other than 200, also 404, or no answer. After a bad document or a failed read, the reader keeps the last good document, for a maximum time (5.3a). Only a good document replaces it.
The reader bounds the size of the document that it reads, and it gives this bound in its documentation. A larger document is bad (5.3c).
The reader MUST give this maximum time in its documentation. The time starts at the last good read. After this time, the reader acts as with no good document of the service (11.1). The decision of an edge for access never depends on the age of the document (8.3). An edge MUST NOT refuse a subject because the document of the service is too old or absent. The PDP answers each other question false with no reason (11.1).
A reader that reads the document of each service at a fixed period SHOULD make these reads at equal intervals over the period. With a period of 5 minutes, it makes approximately 3.3 reads each second for 1,000 services and approximately 33 for 10,000. The reader keeps the last good document of each service. With a bound of 64 KiB for each document, they take approximately 66 MB at most for 1,000 services and 655 MB for 10,000.
A reader MUST accept a document of 64 KiB, with 64 actions, 16 types, 256 resources and 16 limit declarations. It MUST accept a label of 60 characters, a description of 300 characters and a unit of 20 characters. A reader MAY accept more. A service SHOULD stay within these numbers, because a reader MAY treat a larger document as bad (5.3).
The labels and the descriptions are in English.
Each use has one action. That action lists each budget that the use spends and each ceiling that applies to the action of the use. A ceiling of another permission of the operation applies only to the part that this permission lets run (5.5a).
A service MUST NOT ask two actions with context.usage for one operation, except to choose the action of the use as 10.1 says. Only the action of the use takes units (5.5a). A PEP can choose the action of a use among several actions for one operation (10.1). Other actions of the operation can list a budget.
An operation can also need permissions on other actions or on other resources. The action of the use is the one action that the call runs and consumes. A service declares the action of the use for each tool and each route, and the PEP names it in its questions. The question of the use is the only question of the operation that can have context.usage (6.4) or context.approval (17.1).
The PEP asks each other permission of the operation with context.permission_only equal to true, and with no context.usage and no context.approval (6.6). The PDP decides such a question as 3.5 says, and it ignores confirm (17.8). It asks only the action of the use with context.usage, when this action lists a budget (6.4). Thus one operation takes units for one action only, and one approval covers the action of the use only. 10.1a gives an example. This is also true when another of its actions lists a budget.
A true answer for one of these other permissions can have context.limits. The PEP applies these ceilings to the part of the operation that this permission lets run (7.5). A question with context.permission_only never gets a reason of 17.1. A PEP that gets such a reason treats it as an answer that is not valid (10.3).
context.permission_only is a member of the context of a question. Its only valid value is true. A question that has permission_only with context.usage or with context.approval gets HTTP 400, or invalid_request in an item of an Access Evaluations request (11.1). Another value gets the same answer. The member is valid with context.match equal to subtree. A PDP that gives no approval ignores the member (AuthZEN 1.0).
A service MAY publish a route that lists the children of a node, page by page, with a search. A system that shows a form for grants, the caller, uses it to show the options of a node. The request is GET /.well-known/procurauth/resources with the query parameters of 5.7, and the answer is a JSON object (5.8).
The request carries an identity token that the edge makes for the person who fills the form (section 9). Only the edge signs identity tokens (9.1, 9.4), so the caller is a part of the edge. The caller sends the request to the origin of the action document (5.1). Thus the rule of 9.4 lets the caller reach the service.
The service checks the token as 9.4 says, and it lists only the children that the subject of the token can see. The member resources of the action document still names the nodes at the top (5.2).
For each child that it lists, the service MUST get a true answer with context.match = subtree (4.4). The question of this answer names an action whose resource_types holds the type of the child (5.2). The service can use a kept answer (10.1). The service MAY also apply its own rules that remove more children, and it gives these rules in its documentation. When the PDP gives no valid answer, the service follows 10.3.
The service SHOULD bound the number of questions to the PDP for one request. When it reaches this bound, it gives the items that it has and a next value (5.7, 5.8). Thus a node with many children that the subject cannot see does not make one request ask the PDP for each child.
The caller encodes the value of each query parameter as 5.2 encodes an id. Each byte outside A-Z, a-z, 0-9, -, ., _ and ~ becomes %XX, with upper-case hexadecimal digits [RFC 3986]. The service decodes each %XX one time. It does not read + as a space. The parameters are:
parent: optional, the path of the node, in the form of the memberpathof 5.2. Without it, the service lists the nodes whose type has the parentservice;type: mandatory, the type of the children. Its parent in the action document is the type of the node ofparent, orservicewhen the request has noparent;q: optional, a search text. The service lists the children whose id or label holds this text, with rules that it chooses;limit: optional, the maximum number of items, a whole number from 1. The service MAY give fewer items;after: optional, the value ofnextin the previous answer.
The service decodes the value of parent one time. Then it reads the value as a path of 5.2: it splits it at each /, and then it decodes each id. Example: the database a/b of the host prod is parent=host%3Aprod%2Fdatabase%3Aa%252Fb.
A parameter is bad when it occurs more than one time, or when its value breaks the rules of 5.7. Thus a type is bad when its parent in the action document is not the type of the node of parent, or service without parent. A bad parameter gets HTTP 400. A request without type also gets HTTP 400. The service ignores a parameter that 5.7 does not name.
A request with no token, or with a token that is not valid, gets HTTP 401 (9.4). A node that does not exist, or that the subject of the token cannot see, gets an answer with no items.
Each item of items is one child of the node, with these members:
id: the id of the child, as 4.1 says. The service does not encode it;label: a short text for the form, for example the id itself;has_children:truewhen the route can list children below this child.
next is the cursor of the next page, or null on the last page. The caller treats it as opaque text. The path of a child is the path of parent, then /, then <type>:<id>, with the id encoded as 5.2 says. Without parent, the path is only <type>:<id>. Example: the databases of the host prod whose names hold test, two at a time (section 13).
GET /.well-known/procurauth/resources?parent=host%3Aprod&type=database&q=test&limit=2 { "items": [ { "id": "test1", "label": "test1", "has_children": true }, { "id": "test2", "label": "test2", "has_children": true } ], "next": null}A caller MUST accept an answer of 64 KiB with 50 items, an id of 256 bytes and a label of 60 characters. The service SHOULD stay within these numbers. A caller MAY treat a larger answer as a failed call.
The caller MAY keep each answer for a short time that it chooses. An entry applies only to the same service, subject and query parameters. The caller never gives an entry to another subject. It bounds the number of entries. This bound does not grow with the number of services: it is the same for 1,000 and for 10,000 services.
The caller bounds the size of an answer and the number of its items. A larger answer is a failed call.
6.Limits and budgets
A limit declaration has name, label, description, unit and kind. The kind is ceiling or budget. A name is unique in the document.
The unit of a ceiling is a plural noun, for example rows, bytes or seconds. The unit of a budget is a singular noun, for example query, export or request. A ceiling gives a maximum of many units, and one use takes one unit of a budget (6.4). A form can show "100 rows" and "1 request" with no change of the text.
A ceiling also has min and max. They are whole numbers, min is 0 or more, and min is not above max. Another value makes the document bad (5.3). A whole number of a limit is at most 2^53-1, which is 9007199254740991. This is the largest integer that is safe in JSON. It applies to min, max, the value of a ceiling and each amount. A larger number makes the document bad, and a PDP refuses a grant with such a value. A budget has neither: a budget declaration with min or max makes the document bad (5.3).
A budget name is the plural noun of the thing that it counts, with no unit and no window, for example requests. A qualifier can come before the noun, for example write_requests for a second budget of requests (6.2). A budget name never starts with max_ (7.1). A grant gives a value for a limit in one of two forms:
- for a ceiling, a whole number from
mintomax, for example30; - for a budget, an array of 1 to 4 items, one item for each window. Each item has
amountandwindow, for example[{"amount": 10, "window": "second"}, {"amount": 300, "window": "minute"}]. The amount is a whole number from 1. The window issecond,minute,hourorday. Two items never have the same window.
Each window of a budget value has its own counter (6.7). A PDP MAY refuse a grant of more than 8 limit values. It documents its bound.
An action lists the limits that apply to it. One use of the action takes units from each budget that it lists. The PEP applies each ceiling that it lists (section 7). To count one action separately, the service declares a second budget and lists it only on that action.
The window is fixed. It starts at a multiple of its length since the Unix epoch, by one clock that all instances of the PDP use. A client can send at most two times the amount around the boundary of two windows. A shorter window on the same grant bounds this burst.
For each use of an action that lists a budget, the PEP sends one question with context.usage (6.11). The one exception is the kept answer of 10.1. For an action without a budget, it sends none. context.usage is an object with one member, units. In this version, units is 1: "context": {"usage": {"units": 1}}. Another value gets HTTP 400.
The PDP first checks the subject, the resource and the grants. It takes units only when they give true. It takes the units from each counter of the use in one atomic step, or from none. When the use also consumes an approval, 17.2 gives the order. These are the counters of each window, for the key and for its owner (6.7). If one counter has fewer units left than the use asks, the PDP takes none. It answers false with the reason budget_exceeded and retry_after (section 11).
A question without context.usage counts nothing.
Each subject that a grant gives a budget has its own counter for each window of that budget value. A use by a key takes units from each of these counters that exists: the counters of the key and the counters of its owner. A use with no counter takes no unit (6.12). The uses of the owner and the uses of all its keys share the counters of the owner. The PDP chooses the counters. The PEP never names a counter.
A PDP with several instances counts each counter one time for all of them. The units that all its instances take from a counter never exceed its amount in one window. No instance counts on its own.
When the PDP cannot read or change a counter that a question needs, it immediately answers HTTP 503, never a decision [RFC 9110, 15.6.4]. A PDP publishes the longest time that it takes to answer a question with context.usage. Within this time, it gives a decision or HTTP 503. The PDP gives this time, in whole seconds, in the metadata member procurauth_usage_max_seconds (section 14).
A limit that no grant gives is no limit from the PDP. A grant value for a limit that the current document of the service does not declare gives nothing. The right of the grant and its other values still apply. The own limits of the PEP still apply.
Only a request with one evaluation can carry context.usage: an Access Evaluation API request, or an Access Evaluations API request without items [AUTHZEN 1.0, l.473]. Any other request that has context.usage at any level gets HTTP 400, and the PDP counts nothing. This applies to an Access Evaluations request with items and to each Search API request. A request with context.usage and context.match = subtree also gets HTTP 400. A PEP that chooses among several actions for one operation follows 10.1.
A true answer to a question with context.usage has context.usage.units: the units that the PDP took from each counter of the use, 0 or 1. The value 0 tells that no budget applies to the subject for this action. A PEP that gets true without this member MUST treat the answer as false.
7.Ceilings
A ceiling is the maximum of one use. A lower value is stricter: a service MUST NOT declare a ceiling where a higher value is stricter. A ceiling name is max_ and a noun, with no unit. A ceiling name that does not start with max_ makes the document bad (5.3). A duration is in whole seconds. Examples: max_rows, the most rows that one read gives, and max_duration, the longest run of one use, in seconds.
For a true answer, context.limits gives each ceiling that the action lists and that a grant gives. It holds only ceilings. The PDP uses a ceiling value only on a grant of the action of the question, for a ceiling that this action lists. The PDP ignores a ceiling value on any other grant. The value is the combination of these grants that cover the resource, as section 8 says. A budget value never appears in an answer.
Example: {"decision": true, "context": {"limits": {"max_duration": 30}}}. For a use of an action that lists a budget, the PEP applies the context.limits of the answer to the question with context.usage (6.4).
A ceiling applies to each use of the action, on each route of the service.
A ceiling is mandatory to understand. A PEP that cannot apply a ceiling of context.limits MUST treat the answer as false. The action document of the service is its adoption: the PDP gives only the ceilings that the action lists. The PEP sends no opt-in member.
The PDP does not add context.limits to a false answer. A PEP ignores it.
8.Combination of values
Limits narrow access. No limit widens it. A decision for a key has two sides, the key and its owner, and each limit value of both sides applies (3.5). For a ceiling, the lowest value applies: among the grants of the asked action that cover the resource (7.3), and between the two sides. For a budget, each side has its own counters (6.7). The PDP never compares two budgets.
A value that only one grant or only one side gives stays as it is.
A subject has one value for each budget of a service. It is on the grant of the action access on the service: the grant that opens the service to the subject. The PDP ignores a budget value on any other grant. An edge gives an identity token for a service only to a subject with a true decision for the action access on that service (3.5). A PEP asks for access only for a route that runs no action of the action document (10.1c).
9.The identity token
An edge authenticates a client and gives a service an identity token. This section defines the token for a person and for a key. A service receives no other token. When a client sends a header with the name of the token header, the edge MUST replace it. The edge MUST remove the text of the key from the request before it sends the request to the service. An edge can be an authentication server that a proxy calls, for example with ForwardAuth. Its answer cannot clear a header of the request, so the proxy removes the text of the key. The edge documents the proxy option that does it.
The token is a JWT, signed with Ed25519 or ES256, with the header type JWT. The operator MUST set the life of the token (exp minus iat) to no more than the maximum age that each service accepts. A service refuses a token with a longer life (9.4). The edge MUST use its signing key only for the identity token. [RFC 9864, 4.1.1] registers the JOSE name Ed25519 for the header alg, and deprecates the name EdDSA [RFC 9864, 4.1.2].
Claims: iss, sub, aud, iat and exp. A token for a key also has owner. A token MAY also have nbf [RFC 7519, 4.1.5]. An edge does not need to give it.
subis the id of the subject (section 3).audis the id of the service.- For a key,
owneris the id of its owner (3.1). The token and the questions never hold the text of the key. The token has noactclaim, becausesubis the key and not the person. iat,expandnbfare whole numbers of seconds since the Unix epoch. Each one is a JSON integer with digits only: it has no fraction, no exponent and no sign. Thus1792569600.0,1.7925696e9and-1are not valid. This rule is stricter than the NumericDate of [RFC 7519, 2], which permits a fraction. It removes the differences between the number readers of the languages, as 17.3 does forop.
The configuration of the service names the token header, the value of iss and the public keys of the edge. It also names the id of the service, its maximum age for a token and its clock skew.
The edge gives its public keys as a JWK Set [RFC 7517, 5]. When the set holds more than one key, the edge puts kid in the header of each token [RFC 7515, 4.1.4]. The service then checks the token with the key that has this kid. The service refuses a token with a kid that the set does not hold. When its set holds more than one key, the service refuses a token without kid. It never tries each key of the set.
For each request other than a read of its action document (5.1) or of a health-probe route (10.1c), the service MUST check that alg is one of the algorithms of 9.2 [RFC 8725, 3.1]. It MUST also check the signature, typ (JWT), iss, aud and exp. It refuses a token without iss, sub, aud, iat or exp (9.3). It refuses a token whose iat, exp or nbf does not have the form of 9.3. It never rounds or converts such a value. aud is the id of the service, or an array that holds it [RFC 7519, 4.1.3].
The service refuses a token whose exp minus iat is more than its maximum age. It also refuses a token whose iat is later than its clock plus the skew. The skew also applies to exp: the service refuses a token when its clock is later than exp plus the skew. When the token has nbf, the service refuses it when nbf is later than its clock plus the skew. It refuses any other typ, for example at+jwt [RFC 8725, 3.12].
The service takes the token only from the header that the edge sets, never from Authorization, a cookie or a query parameter. The service MUST accept requests only through the edge, for example with a network rule (section 12). The service answers a read of its action document (5.1) without a token, through the edge. A request with no token, or with a token that is not valid, gets HTTP 401. The service MUST ignore an unknown claim.
The read of the action document and a health-probe route (10.1c) are the two exceptions to the rule on the edge. The service can answer this read directly to the reader of 5.3 that the operator names. It can answer a health probe directly to the system that supervises it.
owner is for logs and for approvals. A service MUST NOT use it in a decision.
The service sends no claim other than sub (3.3) to the PDP.
The token carries no grant, no limit and no decision. A decision comes only from the PDP. A service MAY keep the result of a token check until exp plus its clock skew (9.4), only for that exact token. It bounds the number of kept results.
An edge that refuses a key answers HTTP 401 with WWW-Authenticate: Bearer. When the request has the text of a key, the header also has error="invalid_token" [RFC 6750, 3.1]. The edge never redirects a request that has the text of a key. The body of this answer is empty. Thus the edge needs no part of the body of the request.
An edge MAY keep an identity token that it made, and give it again to the same subject for the same service. It gives a kept token only after it authenticated the client and got a true decision for access (8.3) for this request. It gives a kept token only before its exp, and it bounds the number of kept tokens.
The number of kept tokens grows with the pairs of a subject and a service that this subject uses. Example: 1,000 subjects that each use 10 of 1,000 services need 10,000 tokens, approximately 10 MB at 1 KB each. If each subject uses 100 of 10,000 services, they need 100,000 tokens, approximately 100 MB. A bound keeps the memory fixed: when the table is full, the edge signs a new token.
10.Requirements for a PEP
Before it integrates, a PEP gets from the operator the URL of the PDP and the credential for the PDP (step 4). It also gets the values of 9.4, except the id of the service. It gives the operator the id of the service (5.2). It also gives the operator the origin of its action document (5.1).
Then the PEP integrates in seven steps:
- Check the identity token as 9.4 says. Send
subas the subject id, with the typeuser(3.3). - Refuse each request without a valid identity token, on each route except the route of the action document (5.1) and a health-probe route (10.1c). Accept requests only through the edge, for example with a network rule (9.4).
- Give each use one action and one resource with its chain (5.5). Declare the actions and their limits in the action document (section 5).
- Ask the PDP for each operation. Use the endpoints of its metadata
/.well-known/authzen-configuration, or the default paths [AUTHZEN 1.0, l.1382]. Send the credential of the service for the PDP inAuthorization: Bearer, a choice that AuthZEN 1.0 leaves free [AUTHZEN 1.0, l.1743-1749]. The PEP MUST secure the link to the PDP by adequate means, for example TLS [AUTHZEN 1.0, l.1739]. Keep answers forcache_ttlat most (10.1). - For a use of an action that lists a budget, send one Access Evaluation with
"context": {"usage": {"units": 1}}(6.4, 6.11). Treat atrueanswer withoutcontext.usage.unitsasfalse(6.12). Reuse a kept answer only as 10.1 says. Do not send it again, except as 10.6 says. - Apply each ceiling of
context.limits(7.5). For a use, take the ceilings of the action of the use from the answer to its question. For an action that lists a budget, this is the question withcontext.usage(6.4). Take the ceilings of each other permission from its own answer (5.5a). - Map each refusal with 10.3.
The PEP MUST ask the PDP for each operation, with three exceptions. For a read of the action document (5.1) and for a health-probe route (10.1c), the PEP asks no question. For a request to the route of 5.6, it asks only the questions of 5.6, without context.usage. For a use of an action that lists a budget, the question with context.usage is the question of the operation (6.4). The PEP MUST NOT send the same question without context.usage before it, except to choose among several actions (below). The questions of the other permissions of the operation have context.permission_only (5.5a). When the answer has a reason of 17.1, 17.7 gives more questions. The PEP MAY keep an answer to a question without context.usage for at most cache_ttl, a time that its configuration sets.
A kept answer applies only to the same subject, action, resource with its chain (resource.properties.ancestors), and context.match. These rules apply to the kept answers:
- A kept
trueanswer never starts a use of an action that lists a budget. The PEP keeps the answers to questions withcontext.usageseparate from the other answers. It never keeps atrueanswer withunitsabove 0. It MAY keep atrueanswer withunitsequal to 0 for at mostcache_ttl. That kept answer is the one exception: it lets a use run with no question (6.12). - A kept
falseanswer MAY refuse a use with no question. - The PEP MAY keep a
falseanswer withbudget_exceededfor the same subject, action, and resource with its chain. It keeps that answer for the lower ofretry_afterandcache_ttlat most. Until then, it refuses the use as 10.3 says. Itsretry_aftergives the seconds to the end of that time. - A PEP never keeps an answer to a question with
context.approval, and it never keeps an answer with a reason of 17.1 (17.7). Atrueanswer that consumed an approval is never kept, also when itsunitsis 0. - A PEP that chooses among several actions for one operation MAY first ask them without
context.usage, in one request. Then it sends one question withcontext.usagefor the action of the use, when this action lists a budget (6.4). - Or that PEP MAY ask them with
context.usage, one at a time, in its order of preference. It stops at the firsttrueor at the firstbudget_exceeded. Afalseanswer withoutbudget_exceededcounted nothing. The PEP MAY keep it as an answer to the same question withoutcontext.usage. If the PEP kept atrueanswer to that question, it deletes its kept answers for that subject and that resource.
An example of 5.5a: an operation copies the table orders of the database test1 into the database test2 of the service datastore (section 13). The action of the use is data.write. For Alice, the PEP first asks data.read on the table orders of test1, with context.permission_only equal to true and without context.usage. Her grant on test1 gives max_rows 1000. Then the PEP asks data.write on the database test2, with context.usage. Only the second question takes a unit. When the first answer is false, the PEP refuses the operation and sends no question with context.usage. A confirm on the grant of data.read changes nothing: only a confirm on data.write asks for an approval.
The value max_rows 1000 applies to the read: thus the copy reads 1000 rows at most. The first question takes no unit, although data.read also lists the budget requests.
The PEP bounds the number of kept answers (10.1). The bound does not depend on the requests of the clients, because a client chooses the resources of the questions. When the table is full, the PEP keeps no new answer.
A route of a service that runs no action of the action document follows one of two rules:
- A health-probe route gives no data of the service, for example a fixed text that tells that the service runs. It needs no identity token, and the PEP asks no question for it. The service gives each such route in its documentation.
- Each other route needs a valid identity token (10.0, step 2). This includes a route that gives a static file. For each request, the PEP asks the action
accesson the resource of typeservice, with the id of the service (4.1). The question has nocontext.usageand nocontext.approval. The route runs only after atrueanswer, and the PEP maps a refusal as 10.3 says.
The action access is never in the action document (5.2). confirm has no effect on it (17.8), so such a route never waits for an approval. A reason of 17.1 in the answer is an answer that is not valid (10.3). The PEP MAY keep the answer for cache_ttl (10.1).
The PEP MUST fail closed. It MUST NOT send context.reason to the client. On an HTTP route, it maps each answer of the PDP as the list below shows. The MCP binding gives the map for an MCP request [MCP-BINDING]. Its tool errors for budget_exceeded and for the reasons of 17.1 are exceptions to the rule on context.reason. The error code approval_cannot_wait is an exception too.
falsewith no reason, or with a reason other thanbudget_exceeded: HTTP 403.falsewith a reason of 17.1, for a call that cannot wait (17.7a): HTTP 403 with the body{"error": "approval_cannot_wait"}. For a call that can wait, 17.7 gives the steps, and the MCP binding gives the result.falsewithbudget_exceeded: HTTP 429, withRetry-Afterset to the seconds ofretry_after(11.1).- No answer, an HTTP error, or an answer that is not valid: HTTP 503.
The PEP MUST NOT send a question with context.usage again after a timeout, a lost answer or a connection error. The one exception: the connection failed before the PEP wrote the request. The units of a lost answer stay counted. The PEP refuses that use as for a PDP that does not answer (10.3). The PEP SHOULD wait for each answer longer than the longest time that the PDP publishes (6.9).
The PEP SHOULD keep its connections to the PDP open between questions [RFC 9112, 9.3]. It SHOULD keep a small fixed number of connections. The PDP publishes the longest time that it keeps an idle connection open. The PEP closes an idle connection before the PDP does: after half of this time, or less. The PDP gives this time, in whole seconds, in the metadata member procurauth_idle_max_seconds (section 14).
A PDP publishes the largest body and the largest number of items of one Access Evaluations request that it reads. A PEP sends its questions in requests within these maxima. When necessary, it splits them into several requests. The PDP gives these maxima in the metadata members procurauth_evaluations_max_bytes and procurauth_evaluations_max_items (section 14). A request above a maximum gets HTTP 400 or 413, and the PDP evaluates nothing.
A PDP publishes the age bound of its directory (3.9) in the metadata member procurauth_directory_max_age_seconds (section 14). The value is a whole number of seconds, from 1. A PEP MAY read it, for example for its logs, and it takes no decision from it. A PEP that does not know the member ignores it.
Unused. The MCP binding holds the tool error of a refused budget [MCP-BINDING].
11.Answers and reasons
A false answer can carry context.reason. The values are:
unknown_subject: the PDP does not know the subject. A revoked, expired or deleted key, a deleted person, and a key whose owner does not exist, get this reason. A subject of a type other thanuser(3.3), and an id with an unknown prefix or a bad local part (3.7), also get it. A subject that fails a condition of 3.5 that can change later gets no reason (11.2);invalid_resource: the PDP checks the resource with the last good action document of the service of the PEP (5.3). It gives this reason when the first object of the chain is not that service, or when the resource is the service of another PEP. A resource below the service with noancestors, or an empty array, has no first object of the chain, so it also gets this reason (4.1). It also gives it when the types of the chain and of the resource do not follow the parents of the document. It also gives it when the document does not declare a type, or when the depth is more than 4. It also gives it when an id or a type name of the chain or of the resource breaks 4.1 or 5.2: an empty id, an id of more than 256 bytes, an id with a control character, a bad type name, or the typeservicebelow the first object. With no good document of the service, the PDP answersfalsewithout a reason for each node, except a question foraccesson the service (8.3, 11.2);invalid_request: only in an item of an Access Evaluations answer. The item has a badcontext.match, a badcontext.permission_only(5.5a), or aresource.properties.ancestorsthat is not an array of objects withtypeandid. In a request with one evaluation, a bad member of this protocol gives HTTP 400. This is a rule of this protocol: the core makes 400 mandatory only when the request does not have a mandatory attribute [AUTHZEN 1.0, l.1416]. Its error table gives 400 to a bad request in general [AUTHZEN 1.0, l.1425-1432];approval_required,approval_pending,approval_deniedandapproval_expired: the action needs the approval of the owner, and 17.1 tells which reason applies. A PDP that gives no approval never answers them;budget_exceeded: a counter of the use has too few units left. The PDP answers HTTP 200 withfalse, never 429. The context also hasretry_after: the seconds to the latest end among the windows of the counters that refuse. It is a whole number, at least 1: a time of 11.2 seconds gives 12. It has the meaning of the HTTP fieldRetry-After[RFC 9110, 10.2.3].
Any other false answer has no reason, for example when no grant covers the resource. An answer never shows the grants.
12.Security considerations
- The PDP trusts the PEP [AUTHZEN 1.0, l.1766]. A PEP that is not safe can name any person as subject. The PDP answers each PEP only for its own service.
- The PDP counts only the uses that a PEP declares with
context.usage. A budget limits the clients of a service, not the service. A PEP that does not sendcontext.usagespends no unit. - A key never has more than its owner has, because of 3.5.
- A new key is a new subject (3.8), so it has new counters and starts with a full budget of its own. When the owner has a budget, the counters of the owner still bound the uses of all its keys (6.7). Give the budget to the owner to bound the uses of all its keys together.
- A client never chooses the owner, the chain or the counter.
- A PEP that ignores a ceiling widens the access. This is why 7.5 makes it mandatory.
- The PDP is a single point of failure. The protocol accepts it: fail closed (6.9, 10.3).
- An old copy of the directory is not safe. This is why 3.9 bounds its age, and 10.7b publishes the bound.
- A client that reaches a service without the edge can use an identity token that it gets until its
exp. It then skips the checks of the edge, for example the decision foraccess(8.3). This is why 9.4 makes a service accept requests only through the edge. - An edge that sends the text of a key to a service lets that service use the key on each other service of the owner. This is why 9.1 makes the edge remove it.
- A client that sends a request again makes a new use. The PDP counts it again. This over-count is safe.
- A PEP that is not safe can mark any question with
context.permission_onlyand so skip the approval of the use. The PDP trusts the PEP for this member, as for each member of the context. - A PEP that is not safe can submit any
opand anyviewfor an approval. The PDP checks only that they fit the effect (17.9). The owner decides on the text that the PEP gave, so the owner must trust the service. - A PDP that gives approvals sees the body of each request (17.9). It is the only place that shows the command to the owner. A PDP that is not safe can show a text that is not the command that the PEP runs. The owner and the service can find the difference only with their own records of the effect (17.10).
- The credential of each service for the PDP (10.0, step 4) SHOULD have at least 128 random bits. The PDP SHOULD keep only its SHA-256 digest, so that a leak of the data of the PDP gives no credential. The digests take approximately 32 KB for 1,000 services and approximately 320 KB for 10,000.
13.Examples
The examples use the service datastore, with the types host, database and table. In the examples, service:datastore names the service, and service:datastore/host:prod names the node host:prod (5.2). This notation is only for the examples and the conformance data.
The action document of the service:
{ "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 } ]}The list of the options gives the databases below host:prod, as the example of 5.8 shows.
A person with two databases. Alice reads the database test1, and she reads and writes the database test2. Both databases are on the host prod. Her grants are:
accessonservice:datastore, with{"requests": [{"amount": 10, "window": "second"}, {"amount": 300, "window": "minute"}]};data.readonservice:datastore/host:prod/database:test1, with{"max_rows": 1000};data.readonservice:datastore/host:prod/database:test2, with{"max_rows": 5000, "max_duration": 30};data.readonservice:datastore/host:prod/database:test2/table:orders, with{"max_rows": 100};data.writeonservice:datastore/host:prod/database:test2, with{"max_duration": 10}.
A read of the table orders of test2, for one use:
{ "subject": { "type": "user", "id": "alice" }, "action": { "name": "data.read" }, "resource": { "type": "table", "id": "orders", "properties": { "ancestors": [ { "type": "service", "id": "datastore" }, { "type": "host", "id": "prod" }, { "type": "database", "id": "test2" } ] } }, "context": { "usage": { "units": 1 } }}The answer:
{ "decision": true, "context": { "limits": { "max_rows": 100, "max_duration": 30 }, "usage": { "units": 1 } }}A ceiling takes the lowest value among the grants of the asked action that cover the resource (8.1). Two grants of data.read cover the table orders, so max_rows is 100, the lower of 5000 and 100. Only the grant on test2 gives max_duration, so its value 30 stays (8.2). The grant of data.write on test2 also covers the table, but it is not a grant of the asked action. Thus its value 10 does not apply to a read (7.3).
The answers to the other questions of Alice, each with context.usage:
data.writeondatabase:test2:true, withmax_duration10.data.readondatabase:test1:true, withmax_rows1000.data.writeondatabase:test1:falsewithout a reason. The PDP takes no unit.data.readonhost:prod:falsewithout a reason. A grant on a database does not cover its host (4.3).
Each use of Alice takes one unit from her counter of the second and one unit from her counter of the minute (6.7). The eleventh use in one second gets false with budget_exceeded (11.1). When the counter of the minute also refuses, retry_after gives the end of the minute, the later end.
A key of Alice. Alice has a key with the subject id key:9b1c04e2aa71f0c3 and these grants:
accessonservice:datastore, with{"requests": [{"amount": 100, "window": "minute"}]};data.readonservice:datastore/host:prod/database:test2, with{"max_rows": 10000}.
The identity token of the key. The header: {"alg": "Ed25519", "typ": "JWT"}. The claims:
{ "iss": "https://edge.example", "sub": "key:9b1c04e2aa71f0c3", "aud": "datastore", "iat": 1792569600, "exp": 1792569900, "owner": "alice"}The service sends only sub to the PDP (9.6). A token for a person has no owner, and its sub is the id of the person.
A use of the key, with one unit:
{ "subject": { "type": "user", "id": "key:9b1c04e2aa71f0c3" }, "action": { "name": "data.read" }, "resource": { "type": "database", "id": "test2", "properties": { "ancestors": [ { "type": "service", "id": "datastore" }, { "type": "host", "id": "prod" } ] } }, "context": { "usage": { "units": 1 } }}The answer, when the use can run:
{ "decision": true, "context": { "limits": { "max_rows": 5000, "max_duration": 30 }, "usage": { "units": 1 } }}The value 10000 of the key is above the value 5000 of Alice, so it has no effect (8.4). The grant of Alice on the table orders does not cover the database test2 (4.3). The use takes one unit from three counters: the minute of the key, and the second and the minute of Alice (6.7). The answer, when the budget is spent:
{ "decision": false, "context": { "reason": "budget_exceeded", "retry_after": 12 }}A PEP that chooses between data.write and data.read asks data.write with context.usage (10.1). The key has no grant of data.write, so it gets false without a reason, and the PDP takes no unit. The PEP keeps this answer and asks data.read with context.usage. The next run within cache_ttl costs one call.
14.Relation to AuthZEN work (informative)
- The chain and the coverage come from a proposal of the author, issue #760 of the AuthZEN repository. The tree of types of the action document (5.2) comes from issue #762. Issue #761 proposes a scoped Resource Search, which this protocol does not define. The three issues are open, and they are not part of AuthZEN. The list of the options (5.6) is a route of the service, not a search of the PDP.
- Issue #521 proposes
context.constraints, a typed list of bounds. It is open. This protocol has the same idea: one list of limits with two kinds. - This protocol adds the members
context.usage,context.limitsandcontext.match. A later value goes inside one of them. This protocol sends nonext_action. context.retry_afterhas the unit and the meaning of theretry_afterof the Access Request and Approval profile [ARAP, l.616], which gives it for a retry. The reasons of this protocol are not ARAP codes.- The token issuance profile asks for a URN for an extension that adds response vocabulary [AUTHZEN-ISSUANCE, l.1189-1192]. This version has no URN member: see section 15, item 5.
- The token issuance profile has a close precedent: a ceiling from the PDP, mandatory-to-understand members, and values that a PEP ignores on a denial [AUTHZEN-ISSUANCE].
- The token issuance profile defines no rate-limit member. It sends such limits as advisory context and as limits on the token that it issues. A downstream enforcement point applies them [AUTHZEN-ISSUANCE, l.183-190, 1011-1049]. This protocol counts in the decision on purpose: one call for each use, and the count and the
trueanswer are one atomic step. - The Obligations profile defines no numeric-limit type. Its obligations are coarse declarative instructions, and the two sides make an agreement about the meaning of the type
custom[AUTHZEN-OBLIGATIONS, l.110, 363-365]. A PEP treats an obligation that it does not know as a denial. - A question with
context.usageis not idempotent. Two equal questions can gettrue, thenfalsewithbudget_exceeded. The idempotence case of the AuthZEN certification (c-2-6) applies only to questions withoutcontext.usage. owneris a private claim [RFC 7519, 4.3]. It is not in the IANA JWT Claims registry. In OAuth token exchange [RFC 8693],subis the person andactis the actor. In this protocol,subis the key. A service that reads onlysubthus decides for the key, never for the person.- The relation of the MCP refusals to the COAZ binding for MCP is in the MCP binding [MCP-BINDING, section 11].
- Section 17 uses the idea of the denial that a person can approve, with
evaluation_id, from ARAP [ARAP]. It differs in four points. An approval has one use. A request has a lease, and the statesabandonedandsuperseded. The PDP keeps the body that the PEP sends. The API gives the PEP only a verdict. - The metadata members of 6.9, 10.7, 10.7a, 10.7b and 17.4a are not in the IANA registry "AuthZEN Policy Decision Point Metadata" [AUTHZEN 1.0, l.1821-1823]. A PEP that does not know them MUST ignore them [AUTHZEN 1.0, l.1342]. Register them before a publication outside the network of the author.
15.Open points
- If AuthZEN adopts the extensibility model of pull request #697 as written, the adoption by the action document (7.5) is not adoption on the wire. A PEP then sends
supported_mandatory_extensions, and the three members of section 14 get names that resist collision. - The conformance cases are data in
conformance/of the repository of this specification, and each case cites a paragraph of this document. The series U is for a PEP, and the series D is for a PDP. The series E is for an edge (1.3), and its cases test 1.4, 8.3, 9.1 to 9.3, the second paragraph of 9.4, 9.8 or 9.9, or the last sentence of 17.8. The MCP binding holds the cases that only MCP needs: U18, U23, U25 to U31 and E01 [MCP-BINDING].conformance/gives none of these ids to another case, so its series E starts at E02. No series tests the system that makes keys (3.2, 3.8) or the caller of the route of 5.6 (5.6 to 5.9) in this version. - A later version can add
remainingtocontext.usage. A PEP can then copy it into theRateLimitfield [RATELIMIT]. The seconds to the end of a window keep one name:retry_after. - Before a publication outside the network of the author, register the well-known name
procurauth[RFC 8615]. The two documents of this protocol are below this name:/.well-known/procurauth/actions(5.1) and/.well-known/procurauth/resources(5.6). - The token issuance profile registers a capability URN for an extension that adds response vocabulary.
context.limitsis such a vocabulary. The project ProcurAuth defines a capability URN later, after a check of its format. No URN member exists in this version. Until then,context.usage.unitsin each counted answer shows that a PDP counts (6.12). - Unused. Paragraph 10.1c gives the rule for a route that runs no action of the action document.
- In this version, only the MCP binding gives an interface that can wait for an approval (17.7a). A call to an HTTP route gets HTTP 403 with the code
approval_cannot_waitwhen the PDP asks for an approval. A later version can define a form of an HTTP route that waits, with a result and the controls of 17.5. - An operation can need a permission on another action (5.5a). One approval covers the action of the use only. The other permissions limit the scope, and the PDP ignores their
confirm. A later version can let one approval cover the whole operation.
16.Implementations and tools (informative)
IMPLEMENTATIONS.md of the repository of this specification lists the known implementations. The repository also has a linter of action documents, a test PDP and a maker of test identity tokens. It also has a checker of key texts, a runner of the conformance cases (15, item 2) and a reference PEP library in Rust. The checker of key texts takes the format of the text as an input, because this protocol defines no format (3.8). docs/ and the README of each crate describe them.
17.Approval of an effect
A use of an action can run only after the approval of a person, the owner of the key, when the PDP asks for it. This section is mandatory for a service (1.3). Each action of a service follows it (5.2b). It defines the question, the answers and the effect of any action (17.1 to 17.3a), and a narrow API for the PEP (17.4). It also gives the rules of the approval (17.5 to 17.12). The PEP learns only the verdict (17.6, 17.12).
The PDP decides if a use of an action needs an approval (17.8). The PEP first asks as 10.1 says, with no effect. When the use needs an approval, the PDP answers false with the reason approval_required. Only the action of the use (5.5a) can need an approval. The PEP then computes the effect of the operation (17.3, 17.3a) and asks again (17.7). It sends the effect as context.approval.effect, the only member of context.approval. A bad effect gets HTTP 400, and the question never has op or view (17.9).
For such a question, the PDP first decides as for a question without the effect (3.5). When this decision is false, the answer does not change. When no grant of the action that covers the resource has confirm (17.8), the PDP ignores the effect. It also ignores it for a question of a person, for the actions access and mcp.session, for a question with context.permission_only (5.5a), and when context.match is subtree (4.4). Otherwise the action needs an approval.
The PDP then looks at the latest approval for the same service, subject, action, resource and effect (17.6). It answers as the list below shows. A false answer takes no unit (6.5).
- There is no approval, or the approval is consumed:
falsewith the reasonapproval_required. - The approval is
pendingorreplied(17.6):falsewithapproval_pending. - The approval is
answeredwithdecline, and the deny time of 17.6 has not ended:falsewithapproval_denied. After the deny time, the answer is as for no approval. - The approval is void (17.6): for a question without
context.usage, the answer is as for no approval. For a question withcontext.usage, it isfalsewithapproval_expired. - The approval can be used (17.6): for a question without
context.usage, the answer istrue, and the PDP consumes nothing. For a question withcontext.usage, 17.2 applies.
A question with no context.approval gets false with approval_required when the action needs an approval and context.match is not subtree. The PDP cannot approve an operation that has no effect. This answer has no evaluation_id.
The answers with approval_required and approval_pending also have context.evaluation_id when the question had an effect. It is a text that only the PDP reads. It binds the service, the subject, the action, the resource and the effect of the question. It stays valid for a time that the PDP publishes. The PEP sends it back as 17.4 says, and it never reads it. An evaluation_id has 1024 bytes at most. A PDP that cannot give an id of this size answers false with no reason (11.2). A PEP treats an answer with a longer id as not valid (10.3).
A question with context.usage and an effect, for an approval that can be used (17.1), is the use of the action. The PDP takes the units (6.5) and consumes the approval. The answer is true with context.usage.units (6.12), only when the PDP did both steps. The PDP never consumes an approval two times.
When a counter refuses, the answer is false with budget_exceeded (6.5). The PDP consumes nothing, and the approval stays usable until its consume_before (17.6). The PEP sends context.usage for the use of an action that needed an approval also when the action lists no budget. This is an exception to 6.4. The answer then has units 0.
A failure of the PDP never loses an approval. When a step fails, the PDP answers HTTP 503 or false, and the approval stays usable. The PDP never leaves an approval consumed when the answer is not true. After a failure, the units MAY stay counted (10.6). One atomic step for both is the preferred design. A PDP can also count the units first, and then consume the approval with one compare-and-set. When the compare-and-set loses, it gives the units back.
The effect of an operation is a hash. It binds the service, the action, the resource and the operation. The hash input is this JSON object, with these four values:
{"v":1,"service":"datastore","action":"data.write","resource":"host:prod/database:analytics","op":{"tool":"run_write_query"}}vis the number 1. It is the version of the hash input.serviceis the id of the service.actionis the name of the action (5.2). Both are strings.resourceis the path of the resource, in the form that 5.2 gives forresources. The path does not hold the service. The service itself has the empty string.opis a JSON object. The service puts in it each value that decides what the operation does. An empty object is valid.
The PEP writes the hash input as JSON text with JCS [RFC 8785]. It encodes the text in UTF-8 and computes SHA-256 over the bytes. The effect is the text sha256: and the 64 lower-case hexadecimal digits of the hash. A PDP computes the effect in the same way.
These rules of JCS matter most for an implementation:
- The text has no white space between tokens.
- The members of an object sort by the UTF-16 code units of their names. This order differs from the order of code points and of UTF-8 bytes for a name with a character above U+FFFF.
- A string has the escapes
\b,\t,\n,\f,\r,\"and\\. Each other character below U+0020 has the form\u00xx, with lower-case digits. Each other character stays as it is, also/, U+007F and U+2028. - An array keeps the order of its items.
- No Unicode normalisation applies. Two forms of one letter give two different effects.
op has only these kinds of value: objects, arrays, strings, true, false, null and integers. An integer is a JSON number with no fraction and no exponent, written as 0 or as digits with no zero at the start. Its value is from -(2^53-1) to 2^53-1. Any other number makes op invalid, for example 1.5, 1.0, 1e2, -0, 9007199254740992 and an integer of more than 64 bits. This rule removes the differences between the number formats of the languages. An op with a duplicate member name or with an unpaired surrogate is also invalid, and so is an op that is not an object. A PEP MUST NOT compute the effect of an invalid op. A PDP MUST refuse it with the error invalid_op.
A view is a template over op. It is not part of the effect. Each value that a view shows is a JSON Pointer [RFC 6901] to a value in op. A pointer that names no value in op makes the view invalid.
The file conformance/vectors/effect.json holds test vectors of this paragraph. For each vector of the group V01, an implementation MUST give the canonical text and the effect of the vector. For each vector of the group V02, it MUST refuse the input.
Each action has an effect. The PEP builds op and view for each use that needs an approval, for any action: a write, a read or a navigation. It builds them only when the PDP asks for an approval (17.7).
opholds the canonical arguments of the call that will run. The PEP defines, for each action, the members ofop. Each value that decides what the call does or what it returns is inop. This includes a value that the PEP sets by default, for example a number of rows.- All the members of
opfeed the effect hash (17.3). Each number inopis an integer. A value that is not an integer goes inopas a text. - The PEP builds
opfrom the arguments of the call and from its own data only. The same call gives the sameop.ophas no value that changes at each call, for example a time or a random number. - When an action serves more than one operation,
opMUST name the operation. Thus an approval for one operation never covers another operation with the same action and resource. The MCP binding gives the member for a tool [MCP-BINDING, 3.5a]. - A call with no argument that decides what it does has
opequal to the empty object. The effect then binds the service, the action and the resource only. - A read has
opwith the arguments of the read, for example the node, a filter and a number of rows. A navigation hasopwith the node and the page. The PEP does not apply a ceiling inop, because the effect comes before the answer that holds the ceilings. viewis the display description ofop. Each value that it shows is a JSON Pointer toop, and it has no separate text (17.9). It shows each value ofopthat comes from the arguments of the call. A text that the PEP fixes, for example the name of the tool, can be in the title.- The PEP never puts a control argument of the agent in
op(17.9a).
The size of op and view together is the size of their JSON texts. It MUST NOT be more than max_command_bytes, the bound that the PDP publishes (17.4a). The PEP MUST NOT cut or hide a part of op or view to make them fit. When they do not fit, the PEP refuses the call and runs nothing. The MCP binding gives the tool error [MCP-BINDING, 5.7a].
The file conformance/vectors/effect.json has vectors for a read and for an empty op.
A PDP that gives approvals serves a narrow API to the PEP. It has the three routes below, and no other route for a PEP. The PEP sends the credential of the service (10.0, step 4). The PDP answers a request with no credential, or with a credential that it does not know, with HTTP 401. It does this as for its evaluation endpoints [AUTHZEN 1.0, l.1425-1432]. A PDP that gives no approval answers a request with a known credential with 403 forbidden. The approval is enabled for the whole PDP, not for each service. Each body is a JSON object, and the schemas approval-submission and approval-verdict define them.
POST /approval/v1/requestssubmits a request. The body hasevaluation_id(17.1),effect,opandview(17.3, 17.9). It also has exactly one ofapproval_ref,lease_sanduntil(17.5). It can havesupersedes, the id of a request of the same subject that this request replaces.GET /approval/v1/requests/{request_id}?subject={subject}&wait={seconds}&renew=truereads the verdict. The query parametersubjectis mandatory. The query parameterswaitandreneware optional. The PDP waits at mostwaitseconds for a verdict other thanpending. It boundswaitand publishes the bound.POST /approval/v1/requests/{request_id}/keepalivehas the body{"subject": "<subject>"}. It renews the lease (17.5) and gives the verdict.
The answer to a submission is HTTP 201 with request_id, code and verdict equal to pending. The code is a short text that the owner sees, and the PEP gives it to the agent. A request for the same service, subject, action, resource and effect can still be pending. The answer is then HTTP 200 with the same request_id and code. This second submission does not renew the lease and does not change the body. The answer to each other route is {"verdict": "<verdict>"}, with a verdict of 17.6.
A read renews the lease only with renew=true, and only when subject is the subject of the request. An unknown request, a request of another service and a request of another subject get the same answer: HTTP 404 with the error not_found. An error has the body {"error": "<code>"}. The codes are:
- 413
command_too_large:opandvieware larger thanmax_command_bytes, the bound that the PDP publishes (17.3a); - 422
effect_mismatch,invalid_view,invalid_op,invalid_evaluation,invalid_argument,lease_requiredandinvalid_lease: 17.5 and 17.9 give the causes. The codeinvalid_argumentalso covers a badapproval_ref; - 409
no_device: the owner has no way to receive the request. 409cannot_supersede: the request insupersedesis consumed; - 429
rate_limited, withretry_afteras in 11.1; - 422
explanation_required: the PDP needs the explanation of the agent, which comes withapproval_ref(17.9a); - 401
unauthorized: the request has no credential, or the PDP does not know the credential. The answer also hasWWW-Authenticate: Bearer; - 403
forbidden: the PDP knows the credential and gives no approval; - 405
method_not_allowedand 415unsupported_media_type: the method or the content type of the request is wrong; - 503
storage_degradedandunavailable: the PDP cannot keep the request now.
A PDP MAY return other codes. A PEP MUST treat a code that it does not know as an error of the PDP. Its caller then gets HTTP 503 (10.3). A 401 and a 403 are errors of the PDP or of its configuration for the PEP, so its caller also gets HTTP 503.
An approval_ref is an opaque text that the agent gets from the PDP by a channel outside this protocol. It is for one use, for one key, and for a time that the PDP publishes. The PDP attaches the intent of the agent to the request. It refuses a reference that is unknown, used, late or from another subject.
A PDP that gives approvals MUST publish these members in its metadata. Each value is a whole number. A time is in seconds.
procurauth_approval_lease_min_secondsandprocurauth_approval_lease_max_seconds: the least and the mostlease_sthat the PDP accepts (17.5). The least value can be above 1;procurauth_approval_grace_seconds: the grace time after a lease ends, before the request isabandoned(17.5);procurauth_approval_revive_seconds: the time after which the PDP refuses to revive anabandonedrequest (17.5);procurauth_approval_max_revivals: the most revivals of one request, as a count (17.5);procurauth_approval_max_life_seconds: the longest life of a request and of the requests that replace it (17.5);procurauth_approval_wait_max_seconds: the bound ofwaitin a read. A largerwaitwaits this time (17.4);procurauth_approval_consume_seconds: the consume time that givesconsume_before(17.6);procurauth_approval_deny_seconds: the deny time after adecline(17.6);procurauth_approval_evaluation_ttl_seconds: the time that anevaluation_idstays valid (17.1);procurauth_approval_ref_ttl_seconds: the time that anapproval_refstays valid (17.4);procurauth_approval_max_command_bytes: the largest size ofopandviewtogether, in bytes (17.3a).
The body of a submission is larger than op and view, because it has other members. The limit of the PDP for a body is thus above procurauth_approval_max_command_bytes.
The agent says how long it waits. It gives lease_s, a whole number of seconds, or until, a time [RFC 3339]. It gives only one of them, in its intent or in the submission. The PDP refuses a request with none (lease_required) and a request with both (invalid_lease). The PDP bounds lease_s and publishes the bounds in the members of 17.4a. A bound can be above 1, so the PEP and the agent read the real bounds in the metadata. The PDP refuses a value outside them, and it never changes it.
The lease of a request with lease_s lasts 3 times lease_s after the last renewal. A renewal is a call of the subject of the request. It is a read with renew=true, a keepalive, or a call of the agent to the PDP. When the lease and a grace time of the PDP have ended, the request is abandoned. A request with until is expired at that time. Each request is expired after the longest life that the PDP publishes for a request and the requests that replace it.
The agent can revive an abandoned request with a renewal. The PDP bounds the time after which it refuses, and the number of revivals, and it publishes both. The PEP never renews on its own (17.7).
A request has one of these statuses: pending, replied, answered, abandoned, expired, cancelled and superseded. replied is pending with a question of the owner to the agent. The owner can still decide. A request is answered when the owner answers approve or decline (17.11). The statuses abandoned, expired, cancelled and superseded are final, except abandoned during the revival time (17.5).
The verdict is what a PEP learns. It has four values:
pending: the status ispendingorreplied;approved: the status isansweredwithapprove, and the approval is consumed or can be used;denied: the status isansweredwithdecline;void: the status isabandoned,expired,cancelledorsuperseded, or the approval was not consumed before itsconsume_before.
An approval is void when its verdict is void. An approval can be used when it is answered with approve, it is not consumed, and the time is not past consume_before. The PDP sets consume_before when the owner answers. It is not before the time of the answer plus a consume time that the PDP publishes. For a request with lease_s, the window is not shorter than lease_s. The agent, an administrator or the revocation of the key can cancel a request.
After a decline, the PDP answers approval_denied for the same effect during a deny time that it publishes (17.1). A void or consumed approval starts no such time. An approval for another effect never depends on it.
A PEP follows these steps for each use of each action.
- Ask the PDP as 10.1 says, with no effect. On
true, or onfalsewith a reason other than 17.1, apply 10.1 and 10.3. The next steps apply only to a reason of 17.1. - Find if the call can wait (17.7a). When it cannot, refuse it as 17.7a says. Send no other question.
- Compute the effect (17.3, 17.3a) from the values that the call will run. Send the question without
context.usage, withcontext.approval.effect(17.1). - On
approval_requiredorapproval_pending: submit the request (17.4) with theevaluation_idof the answer. A second submission gives the same id and code. Tell the agent that the action waits, and run nothing. When the call has none of the controls of 17.5, the PEP cannot submit. It refuses the call, and the MCP binding gives the error. - On
approval_deniedorapproval_expired: refuse the call, and send no question withcontext.usage. - On
true: compute the effect again from the values that the PEP runs. Send the question withcontext.usageand this effect (17.2). Run the action only after atrueanswer to this question. - Treat any other answer as 10.3 says.
The PEP never runs an action after an answer to a question that has context.approval and no context.usage. It never keeps an answer to a question with context.approval, and it never keeps an answer with a reason of 17.1 (10.1). The PEP renews a lease only for a call of the agent that names the request, never on a timer of its own.
An operation can need permissions on other actions (5.5a). The approval gates the action of the use only, and it covers only the use. The PEP asks each other permission with context.permission_only, as 5.5a and 10.1a say. The PDP gives no reason of 17.1 for such a question, so the other permissions never wait and never fail closed because of confirm (15, item 8).
The retry of a call. A PEP can tell the agent that an action waits. The agent then calls again. Each retry has the same arguments and exactly one control argument: approval_ref, lease_s or until (17.5). The same arguments give the same effect (17.3). A service MAY refuse a retry with no control argument, also when the approval waits [MCP-BINDING, 5.7]. A changed argument gives another effect, and it needs its own approval.
Example: the first call has the arguments {"host": "prod", "table": "orders", "lease_s": 600}. The retry has the same arguments, with lease_s again.
The PEP sends the control arguments of the agent to the PDP in the form that 17.4 gives, and no other text of the agent. It never reads an approval_ref or an intent. It gives the agent only the verdict (17.12). A verdict that the PEP does not know is void.
A call can wait when its interface has two things. The first is a result that tells the agent that the action waits, with the id and the code of the request. The second is a way for the agent to give one of the controls of 17.5. The MCP binding gives both for a tools/call [MCP-BINDING, 5.7]. A call that cannot wait is, for example, a request of a key to an HTTP route. Another is an MCP method that has no tool, when the service asks an action other than mcp.session for it.
When the PDP answers a reason of 17.1 to a call that cannot wait, the PEP MUST refuse it. It MUST NOT run it, and it sends no effect and submits no request. On an HTTP route, the refusal is HTTP 403 with the body {"error": "approval_cannot_wait"}. The code is stable. For an MCP request, the MCP binding gives the refusal [MCP-BINDING, 5.1]. A person never gets a reason of 17.1 (17.8), so this rule applies to a key.
A grant can have the member confirm, true or false. The default is false. It is a restriction, like a ceiling (8.1). An action needs an approval when one grant of the action that covers the resource (4.3) has confirm equal to true. For a key, the grants of the key and the grants of its owner both count (3.5, 8.1). The strictest side wins.
The confirm of a grant of a person has no effect on the questions of that person. A person who approves their own action adds no check. The member applies to the keys of the person, and to the agents that use them, through the side of the owner.
The member has no effect on the action access (8.3), on the action mcp.session, on a question with context.permission_only (5.5a) and on a question with context.match equal to subtree (4.4). Thus a confirm on a permission that an operation asks as an other permission limits the scope only. It asks for an approval only for a call whose action of the use it is. The action mcp.session opens the MCP endpoint and answers a method that has no tool. It has no effect to approve, and it never waits [MCP-BINDING, 3.6a]. A PDP SHOULD refuse a grant of access or of mcp.session that has confirm equal to true. A PDP that keeps such a grant ignores confirm. An edge asks only access, so it never asks for an approval, and it ignores confirm. A true answer for access from a grant with confirm stays a true answer.
The PDP MUST check each submission before it keeps it. The effect MUST be the effect (17.3) of the service of the credential, the action and the resource of the evaluation_id, and the op. A difference gets effect_mismatch. An op that 17.3 refuses gets invalid_op. An evaluation_id that is unknown, late, or from another subject or effect gets invalid_evaluation.
A view is a JSON object. Each of these members is optional, and the view has no other member:
title: a text;fields: an array of pairs, a text and a JSON Pointer to a value ofop;body: a JSON Pointer to a text ofop;body_label: a text.
When title is absent, the PDP shows the name of the action as the title. A view with no fields and no body shows no value. The object {} is a valid view.
A pointer that names no value, or a pair that is not a text and a pointer, makes the view invalid (invalid_view). The text of a label and of a title is the text of the service. The owner reads the values of op, never a text that the service wrote separately. The PEP sends op, view and effect only in a submission. The question has the effect only.
The body of a request has two parts. The command is op and view. The service gives it, it is bound to the effect, and it is the text that the owner trusts. The explanation is a text of the agent that has no value for the decision. The agent gives it to the PDP, by a channel outside this protocol.
The explanation never enters the effect. The PEP never sees it. The values explanation, allow_custom, allow_ask_back, hint, lease_s, until, approval_ref, wait_s and supersedes are control arguments of the agent. They never enter op.
A PDP that keeps the body of a request SHOULD encrypt it at rest. It SHOULD delete the body after a time that it publishes, and keep the effect. It never writes a body in a log. A service SHOULD record the effect and the command that it ran. This record lets the owner find a difference between the command shown and the command run.
The PDP accepts an answer to a request only from an authenticated session or device of the owner of the key. It never accepts it from a key or from the service. The answer has approve or decline and shown_effect. The PDP refuses an answer when shown_effect is not the effect of the request. Only the first valid answer counts.
A decline can have a text, with the intent comment or change_request. The PDP accepts it only when the intent of the agent says so. An approve never has a text. The text goes only to the agent. The owner never changes the command, so a change request is a refusal.
A PDP gives a PEP only the verdict (17.6), the reasons of 17.1 and, at submission, the id and the code of the request. It never gives the PEP the text of a refusal, the identity of the owner, a device or the explanation. It gives no discussion, no time of an answer, no lease and no count of renewals. A PEP never tries to get them.
References
- [AUTHZEN] (also cited as [AUTHZEN 1.0]) AuthZEN Authorization API 1.0, Final Specification, OpenID Foundation. A citation l.N is a line of
api/authorization-api-1_0.mdin the repositoryopenid/authzenat commit4deba63. - [AUTHZEN-ISSUANCE] AuthZEN Profile for OAuth 2.0 Token Issuance, Draft 1:
profiles/authzen-oauth/authzen-oauth-token-issuance-1_0.mdat the same commit. - [AUTHZEN-OBLIGATIONS] AuthZEN Profile for Obligations, Draft 1:
profiles/authzen-obligations-profile-1_0.mdat the same commit. - [ARAP] AuthZEN Access Request and Approval Profile, Draft 1:
profiles/authzen-access-request-approval/authzen-access-request-approval-profile-1_0.mdat the same commit. - [MCP-BINDING] The MCP binding of ProcurAuth, an internal binding of this protocol:
bindings/mcp/in the repository of this specification. It is normative for a service with an MCP endpoint and for an edge in front of such a service (1.3). - [RATELIMIT] IETF RateLimit header fields for HTTP, draft-ietf-httpapi-ratelimit-headers-11.
- [RFC 2119] Key words for use in RFCs to Indicate Requirement Levels. [RFC 8174] Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words.
- [RFC 3339] Date and Time on the Internet: Timestamps.
- [RFC 3986] Uniform Resource Identifier (URI): Generic Syntax.
- [RFC 6750] The OAuth 2.0 Authorization Framework: Bearer Token Usage.
- [RFC 6901] JavaScript Object Notation (JSON) Pointer. [RFC 8785] JSON Canonicalization Scheme (JCS). [FIPS 180-4] Secure Hash Standard, which defines SHA-256.
- [RFC 7515] JSON Web Signature (JWS). [RFC 7517] JSON Web Key (JWK).
- [RFC 7519] JSON Web Token. [RFC 8693] OAuth 2.0 Token Exchange. [RFC 8725] JSON Web Token Best Current Practices.
- [RFC 8615] Well-Known Uniform Resource Identifiers.
- [RFC 9110] HTTP Semantics. [RFC 9112] HTTP/1.1.
- [RFC 9864] Fully-Specified Algorithms for JSON Object Signing and Encryption (JOSE) and CBOR Object Signing and Encryption (COSE).