Version 1.1 JSON schemas and conformance data

Conformance

245 conformance cases as data, and the JSON schemas of the documents. Each case cites a paragraph of the protocol. A team that builds agents uses them to test two points. A service refuses a key beyond the rights of its owner. A spent budget stops the agent.

How the cases are organised

The cases are data, in the directory conformance/ of the repository. The repository has 245 cases: 127 in the series U, 98 in the series D and 20 in the series E. Each case cites the paragraphs of the protocol that it tests.

The series show who the case tests. A PEP, a PDP and an edge have their own series. Three paragraphs count most for agents: 3.5 (a key never has more than its owner), 6.5 (how a budget is counted) and 10.3 (the refusals).

SeriesCasesTestsCases cite
U127A PEP: the service side of the protocol, with the approval of section 17.3.3, 3.4, 4.1, 4.4, 4.5 and the other paragraphs that 1.3 lists for a service, and the MCP binding.
D98A PDP: decisions, coverage, limits, counters, reasons and approvals.Sections 3 and 4, 5.1 to 5.5, sections 6 to 8, 10.7, 10.7a, 10.7b, 11, 12 and 17.
E20An edge: the key, the identity token and the refusals of a key.1.4, 8.3, 9.1 to 9.3, the second paragraph of 9.4, 9.8, 9.9 and the last sentence of 17.8.
conformance/
cases/one file for each case, named by its id, for example U03.json
U/127 cases for a PEP
D/98 cases for a PDP
E/20 cases for an edge
directories/twelve data files for the test PDP
vectors/the test vectors of the effect of 17.3, which are not cases
COVERAGE.mdthe cases of each paragraph, and the rules that no case tests
README.mdthe data model
schema-check/a Rust crate whose tests check each file

The MCP binding gives the ids U18, U23, U25 to U31 and E01 to the cases of its section 9. These cases are in the same directory, with exactly these ids. Each one cites a paragraph of the binding and has the condition no_mcp_endpoint.

Section 17 of the protocol is mandatory for a service (1.3, 5.2b). A PEP runs each case of section 17, and no case of the series U has the condition no_approval_support. A PDP MAY give no approval. A PDP or an edge that gives no approval skips D76 to D89, D91 to D93, D95 to D97 and E19, with this condition. The case D97 also has the condition no_pdp_credential.

Test directories

A PDP case names a directory file: the data that the PDP under test must hold. Each file is valid against the schema fake-pdp-data.

The twelve directory files
FileContent
datastore.jsonThe data of section 13 of the protocol, with Alice, Bob and their keys.
budgets.jsonSubjects with one to four windows, owners with budgets, counters.
ceilings.jsonSeveral grants of one action with different values.
keys.jsonActive, revoked and expired keys, and a key whose owner does not exist.
subtree.jsonPersons and keys for the rule of 4.4.
tree.jsonFour levels of types and special characters in ids.
services.jsonThree services with a credential each.
access.jsonPersons and keys with and without a grant of access.
maxdoc.jsonThe largest document that a reader must accept (5.3c).
session.jsonThe action mcp.session, and a person and a key with a grant of it that has confirm (17.8).
bignumber.jsonA ceiling whose max is 9007199254740991, the largest number of a limit (6.1).
approvals.jsonKeys with a grant that has confirm, and approvals in each status (17.6).

One case

A case has a list of steps. A step sends one request and checks the result. The schema is closed: an unknown member is an error. A case tests one rule and has one reason to fail.

MemberMeaning
idThe id of the case. The letter of the id is the series. The number has two or three digits.
titleOne sentence that states the rule that the case tests.
rolepep, pdp or edge.
paragraphsThe paragraphs that the case tests, for example ["7.3", "8.1"]. A paragraph of the MCP binding has the prefix mcp:.
requirementMUST or SHOULD. The failure of a SHOULD case is a warning.
skip_ifOptional. Conditions that make the runner skip the case, for example no_budget_action or no_mcp_endpoint. The list of the conditions is below.
givenThe set-up: directory, clock, counters, tokens and, for a PEP, pdp_script and approval_script.
stepsThe steps in order. A step has an optional name and skip_if, a request and an expect.
notesOptional. A remark for the reader.

This case, D05, tests how a PDP combines ceilings. It uses Alice and the service of section 13 of the protocol. The file is conformance/cases/D/D05.json.

conformance/cases/D/D05.json (the head)
{  "id": "D05",  "title": "A ceiling takes the lowest value among the grants of the asked action, and a key never goes above its owner.",  "role": "pdp",  "paragraphs": ["7.3", "8.1", "8.4"],  "requirement": "MUST",  "given": { "directory": "datastore.json" },  "steps": [ ... 3 steps ... ]}
The whole case D05, with its three steps
conformance/cases/D/D05.json
{  "id": "D05",  "title": "A ceiling takes the lowest value among the grants of the asked action, and a key never goes above its owner.",  "role": "pdp",  "paragraphs": ["7.3", "8.1", "8.4"],  "requirement": "MUST",  "given": { "directory": "datastore.json" },  "steps": [    {      "name": "Alice reads the table orders of test2",      "request": {        "endpoint": "evaluation",        "body": {          "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 } }        }      },      "expect": {        "status": { "equals": 200 },        "json": {          "/decision": { "equals": true },          "/context/limits/max_rows": { "equals": 100 },          "/context/limits/max_duration": { "equals": 30 },          "/context/usage/units": { "equals": 1 }        }      }    },    {      "name": "A value of data.write does not apply to data.read, and the reverse",      "request": {        "endpoint": "evaluation",        "body": {          "subject": { "type": "user", "id": "alice" },          "action": { "name": "data.write" },          "resource": {            "type": "database",            "id": "test2",            "properties": {              "ancestors": [                { "type": "service", "id": "datastore" },                { "type": "host", "id": "prod" }              ]            }          },          "context": { "usage": { "units": 1 } }        }      },      "expect": {        "status": { "equals": 200 },        "json": {          "/decision": { "equals": true },          "/context/limits/max_duration": { "equals": 10 },          "/context/limits/max_rows": { "absent": true }        }      }    },    {      "name": "The value 10000 of the key is above the value 5000 of Alice",      "request": {        "endpoint": "evaluation",        "body": {          "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 } }        }      },      "expect": {        "status": { "equals": 200 },        "json": {          "/decision": { "equals": true },          "/context/limits/max_rows": { "equals": 5000 },          "/context/limits/max_duration": { "equals": 30 }        }      }    }  ]}
What a step can expect
Member of expectMeaning
status, headers, body_text, jsonThe HTTP answer. json names members by JSON Pointer.
valid_asThe body is a good action_document or options_answer, checked with the readers of the core. Two more values check that no action has the member approval, and that pep.approval_calls has an entry for each action.
pdp_questionsFor a PEP: the questions that the test PDP received during the step, with a count.
pdp_connectionsFor a PEP: the connections that carried a request during the case.
pdp_approvalsFor a PEP: the requests that the test PDP received on its approval API during the step (17.4), with a count.
upstreamFor an edge: the request that reached the service behind the edge, its headers and the claims of its token.

A request names its target in one way. A PEP case gives an operation, and the profile maps it to a request of the service. A PDP case gives an endpoint: evaluation, evaluations, metadata or approval_requests. The last one is POST /approval/v1/requests of the approval API (17.4). A case can also write a request in full, with method and path.

The operations of a PEP case
OperationMeaning
use_plainOne use of an action that lists no budget, on a node below the service.
use_budgetOne use of an action that lists a budget, on a node below the service.
use_ceilingOne use of an action that lists a ceiling.
use_serviceOne use on the service itself.
use_multiOne use of an action that lists a budget and needs one more permission, on another action or another node. It is an HTTP route.
read_actionsA read of the action document.
list_optionsA read of the first level of the options route.
read_healthA read of a health-probe route of the service, with no token (10.1c).
use_no_actionA request to a route that runs no action of the action document, for example a static file (10.1c).
mcp_call_plainA tools/call of a tool whose action lists no budget.
mcp_call_budgetA tools/call of a tool whose action lists a budget.
mcp_call_inputA tools/call that ends with InputRequiredResult.
mcp_call_multiA tools/call of a tool that needs two permissions. It is the MCP form of use_multi.
mcp_call_approvalA tools/call of the tool of one action. The runner runs the case once for each entry of pep.approval_calls (5.2b).
mcp_approveThe approval of the call of the step before, and the run of the tool.
mcp_refuseThe refusal of the approval of the call of the step before.
The variants of mcp_call_approval

The base call has the control argument lease_s equal to 900. The member variant of the request changes it.

VariantThe call
effect_2An argument that decides what the tool does changes. The effect is the variable effect_2.
effect_3Another change of that argument. The effect is the variable effect_3.
approval_refThe control argument approval_ref replaces lease_s.
waitThe control argument wait_s is added. The effect does not change (17.9a).
no_controlThe call has no control argument: no lease_s, no approval_ref and no until.
Tokens and scripts
MemberMeaning
tokensThe identity tokens of the steps, each with a name. A token has a subject. It can have owner, alg, claims, header and one defect.
nbfA member of a token. The value iat gives an nbf equal to iat, and the token is good. The value future gives an nbf later than the clock plus the skew, and the token is bad (9.4).
number_formsA member of a token. It gives a JSON form to the number of a claim, for example {"iat": "exponent"}. The forms are fraction, exponent and negative. The value stays the same, and each form makes a bad token (9.3).
pdp_scriptFor a PEP: the answers of the test PDP. Each rule has when and respond. The first rule whose when matches the question gives the answer. A when can have subject, action, resource, usage, match, effect, no_effect and permission_only.
timesA member of a rule of a script: a whole number from 1. The rule answers that number of questions, and then the runner reads the next rules. A case uses it to give two answers to one question in order.
approval_scriptFor a PEP: the answers of the test PDP on its approval API (17.4). A when has route (submit, status or keepalive) and request_id. A request that no rule matches gets HTTP 404.
The variables of a case

A case writes a variable as {{name}} in a string or in the name of a member. The runner replaces it before it uses the value.

VariableValue
serviceThe id of the service under test.
actionThe action of the operation of the step.
resource_typeThe type of the node of the operation.
resource_idThe id of the node of the operation.
ancestorsThe chain of the node of the operation, as an array.
toolThe name of the tool of the MCP operation of the step.
ceilingThe name of a ceiling that the action of use_ceiling lists.
ceiling_valueA value of that ceiling, from its min to its max.
options_typeThe type of the nodes at the first level of the options route.
mcp_pathThe path of the MCP endpoint.
token_headerThe name of the header of the identity token.
unknown_key_textA text that has the format of a key, and that the edge does not know.
valid_key_textThe text of a key that the edge accepts.
valid_key_subjectThe subject id of that key.
valid_key_ownerThe owner of that key.
no_access_key_textThe text of a key that the edge knows, whose subject has no true decision for access.
other_actionThe action of the other permission of the call of mcp_call_approval (5.5a), or a hyphen when the call has none.
effectThe effect of the base call of mcp_call_approval (17.3).
effect_2The effect of the call with the variant effect_2.
effect_3The effect of the call with the variant effect_3.
approval_refThe opaque text that the variant approval_ref gives. It is ref_conformance_0001.
confirm_access_key_textThe text of a key that the edge knows, whose subject has a grant of access with confirm equal to true.
token_<name>The text of the token <name> of given.tokens.
The conditions to skip a case
ConditionMeaning
no_budget_actionThe service has no action that lists a budget.
no_ceiling_actionThe service has no action that lists a ceiling.
no_options_routeThe service does not publish the options route.
no_answer_cacheThe PEP keeps no answer (10.1 says that it MAY).
no_token_cacheThe edge keeps no identity token (9.9 says that it MAY).
no_mcp_endpointThe service has no MCP endpoint.
no_budget_sessionThe action mcp.session lists no budget (binding 3.6a).
no_input_toolThe service has no tool that asks the client for input.
no_multi_actionThe service has no use that needs two permissions: no HTTP route and no tool.
single_key_setThe key set of the edge holds one key only. For a PEP, the profile has one signing key only.
no_approval_supportThe PDP or the edge gives no approval (section 17). It never holds for a PEP.
no_pdp_credentialThe profile of a PDP gives no credential of the service. The PDP can then accept a request with no credential.

A PEP declares use_multi, mcp_call_multi or both. The cases U34 and U35 have one step for each form: the HTTP route and the tool. The step of the tool has the condition no_mcp_endpoint. The runner skips a step whose operation the profile does not define. A case passes when at least one step runs and no step fails.

The case cites 7.3, 8.1 and 8.4. A matcher has exactly one member: equals, absent, present, regex, not_regex or one_of. Schema: conformance-case.

Coverage

COVERAGE.md lists each paragraph that a role must follow, and the cases that test it. It has 164 rows (88 for a PEP, 64 for a PDP, 12 for an edge). 29 rows have no case. A second table lists the groups of vectors V01 and V02 of vectors/effect.json. A third table lists 85 rules that no case can test, each with its reason. Examples: a case cannot see the effect of a ceiling, the age of a copy of the directory, or the memory of the PEP.

The tests of the crate schema-check read this file. They check the ids, the paragraphs and the roles, and that COVERAGE.md agrees with the cases.

JSON schemas

The directory schemas/ holds 19 JSON schemas, one for each document. Each has a $id below https://procurauth.github.io/procurauth/schemas/, so each link in the table opens the schema. Use any JSON Schema validator. access-lint checks more than a schema can, for example that a limit name is declared.

SchemaChecksRules
access-lint-output.schema.jsonThe JSON output of access-lint.–
access-token-config.schema.jsonThe configuration of a service for access-token check.9.4
action-document.schema.jsonThe action document of a service.5.2, 6.1
approval-submission.schema.jsonThe body of a submission to the approval API: evaluation_id, effect, op, view, and one of approval_ref, lease_s and until.17.4, 17.9
approval-verdict.schema.jsonThe answers of the approval API: the verdict, the answer to a submission, the body of a keepalive and an error.17.4, 17.6
approval-view.schema.jsonThe view of a submission, with JSON Pointers to op.17.9
conformance-case.schema.jsonOne conformance case.–
conformance-profile.schema.jsonThe profile of a target for access-conformance.–
conformance-report.schema.jsonThe JSON report of access-conformance.–
effect-vectors.schema.jsonThe test vectors of the effect, conformance/vectors/effect.json.17.3
evaluation-context.schema.jsonThe members that the protocol adds to the context of a question and an answer: usage, limits, match, approval, permission_only, evaluation_id, reason and retry_after.5.5a, 6.4, 7.3, 11.1, 17.1
fake-pdp-data.schema.jsonThe data file of fake-pdp, and the data of a test directory.–
grants-file.schema.jsonThe file of grants of access-lint --grants.8.3
identity-token-claims.schema.jsonThe claims of an identity token. $defs.header checks its header.9.2, 9.3
key-format.schema.jsonThe format file of keycheck and of the reference edge.3.8
keycheck-output.schema.jsonThe JSON output of keycheck.–
limit-values.schema.jsonThe limit values of a grant.6.1
options-file.schema.jsonThe file of access-lint --options: an answer, or an envelope with query and answer.5.7, 5.8
options-route-answer.schema.jsonThe answer of the options route.5.8

Run the cases

Use access-conformance. It needs a profile: one JSON file with a section for each role. The run needs only the section of its role.

A path in the profile starts at the directory of the profile. A secret comes only from a file. The examples are in crates/access-conformance/examples/. The tool speaks plain HTTP.

Against a PEP (series U)

The runner acts as the client, as the edge and as the PDP. It signs the identity tokens with a private key. The service must trust the public key and must call the PDP address of the profile. The profile maps each abstract operation (use_plain, use_budget, mcp_call_plain and others) to a request of your service. An operation that the profile does not define makes the runner skip the steps that use it.

A PEP with an MCP endpoint also gives approval_calls: one call for each action of its action document, except mcp.session. The runner runs each case that uses mcp_call_approval once for each entry.

pep.json (the head of the example)
{  "pep": {    "service": "datastore",    "token": {      "header": "X-Identity-Token",      "iss": "https://edge.example",      "max_age_seconds": 300,      "skew_seconds": 30,      "keys": [        {          "alg": "Ed25519",          "kid": "edge-ed25519",          "file": "test-edge-ed25519.pem"        },        {          "alg": "ES256",          "kid": "edge-es256",          "file": "test-edge-es256.pem"        }      ]    },    "pdp": {      "listen": "127.0.0.1:8181",      "credential_file": "pdp-credential.txt"    },    "answer_cache": false,    "options_type": "host",    "mcp": { "path": "/mcp", "session_budget": false },    "operations": { ... },    "approval_calls": { ... }  },  "timeouts": { ... }}
PEP
access-conformance --role pep --profile pep.json \    --url http://127.0.0.1:8000

The file crates/reference-service/PROFILE.md gives the profile of the reference service. A run is only useful if it can fail. This run uses the reference service with a maximum token age of 7,200 seconds. The service then accepts a token with a long life, and the case U48 fails. The lines below show the form of the output.

Example, a failing run
$ access-conformance --role pep \    --profile conformance-profile.json \    --url http://127.0.0.1:8080U48  fail  9.4  step "A token with a long life": status: expected 401, found 200 (and 1 more)127 cases: 125 passed, 1 failed, 1 skipped$ echo $?1

Against a PDP (series D)

The runner sends the questions of the series D and compares the answers. The PDP under test must hold the directory of each case. The runner proves it first, with control questions that count nothing. For a test of the runner itself, set pdp.spawn_fake_pdp and give no --url: the runner then starts fake-pdp in its process.

A PDP that gives approvals needs pdp.approvals in the profile. Without it, the runner skips the cases of section 17 with the condition no_approval_support. A profile with no credential of the service makes the runner skip D97.

pdp-fake.json
{ "pdp": { "spawn_fake_pdp": true } }
PDP, fake-pdp in the process
access-conformance --role pdp --profile pdp-fake.json \    --series D

For an external PDP, the cases that use a budget need a clock and counters that the runner controls. The profile gives pdp.load (a request that loads the data of a case), pdp.reset_url and pdp.clock_admin_url. fake-pdp --admin offers these requests. When the profile gives none of them, the runner skips these cases and prints the reason.

pdp-external.json
{  "pdp": {    "credential_file": "pdp-credential.txt",    "directory_check": {      "mode": "control_questions",      "max_questions": 100    },    "load": {      "url": "http://127.0.0.1:8181/__load",      "method": "PUT"    },    "clock_admin_url": "http://127.0.0.1:8181/__fake/clock"  }}
PDP, a separate process
access-conformance --role pdp --profile pdp-external.json \    --url http://127.0.0.1:8181

Against an edge (series E)

The runner acts as the client, as the service behind the edge and as the PDP. It sends three key texts, each in a file. The first key is valid. The second key is known, but its subject has no access. The edge does not know the third key.

The runner checks the identity token that arrives with the public keys of edge.trust. It starts fake-pdp on edge.pdp.listen.

A fourth key text, edge.keys.confirm_access, is optional. The subject of this key has a grant of access with confirm. Without it, the runner skips E19.

edge.json
{  "edge": {    "service": "datastore",    "token_header": "X-Identity-Token",    "trust": {      "iss": "https://edge.example",      "max_age_seconds": 300,      "skew_seconds": 30,      "jwks_file": "edge-jwks.json"    },    "keys": {      "valid": {        "text_file": "edge-valid-key.txt",        "subject": "key:ann-k1",        "owner": "ann"      },      "no_access": { "text_file": "edge-no-access-key.txt" },      "unknown": { "text_file": "edge-unknown-key.txt" }    },    "upstream": { "listen": "127.0.0.1:9000" },    "pdp": {      "listen": "127.0.0.1:8181",      "directory": "access.json",      "credential_file": "pdp-credential.txt"    },    "mcp_path": "/mcp",    "token_cache": false  }}
Edge
access-conformance --role edge --profile edge.json \    --url http://127.0.0.1:8090

Read the result

ResultMeaning
passEach step of the case passed.
failA check of a MUST case failed. The exit code is 1.
warnA check of a SHOULD case failed. The exit code does not change.
skipThe case does not apply to the target, for example a service with no options route. The line gives the reason.

The summary line is N cases: P passed, F failed, S skipped, with , W warned when a SHOULD case failed. The exit code is 0 when no case failed and 1 when a case failed. It is 2 for a usage error, a bad profile, bad data or a target that is not reachable.

--print-config checks the profile and prints the value that applies for each key. The program also writes these values to the standard error at start, with the prefix config:. A secret never shows. --format json writes the report of the schema conformance-report.

Results of the reference programs

The script scripts/conformance.sh [pep|pdp|edge|all] builds the programs and runs the runner against the reference programs. It starts all the processes in one Docker container. The container has no network and the repository is read only. A time limit of 600 seconds stops the run. The exit code is 0 when no case failed. scripts/ci.sh runs it after the tests.

RunTargetPassedFailedSkipped
U, the action mcp.session lists a budgetreference-service12700
U, the action mcp.session lists no budgetreference-service12601 (U95, no_budget_session)
D, fake-pdp in the process of the runnerfake-pdp9701 (D97, no_pdp_credential)
D, fake-pdp as a separate processfake-pdp with --admin9800
Ereference-edge2000
Summary of scripts/conformance.sh all
U, action mcp.session with no budget: 127 cases: 126 passed, 0 failed, 1 skipped (exit 0)U, action mcp.session with a budget: 127 cases: 127 passed, 0 failed, 0 skipped (exit 0)D, fake-pdp in the process of the runner: 98 cases: 97 passed, 0 failed, 1 skipped (exit 0)D, fake-pdp as a separate process: 98 cases: 98 passed, 0 failed, 0 skipped (exit 0)E (reference-edge): 20 cases: 20 passed, 0 failed, 0 skipped (exit 0)

With mcp.session on the list of the budgets, the case U95 runs. Without a budget on that action, U95 is skipped with the reason the action mcp.session lists no budget. The profile of the run in the process of the runner gives no credential of the service, so D97 is skipped. The run against the separate process gives a credential, and D97 passes. The file docs/design/integration-log.md records these results.

What the cases do not test

No series tests the system that makes keys (3.2, 3.8) or the caller of the options route (5.6 to 5.9). The cases cover a PEP, a PDP and an edge only.

85 rules of the protocol have no case, with a reason in COVERAGE.md. For example, a case cannot see the effect of a ceiling, the security of the link to the PDP, or the memory of a PEP.