arp-policy
A minimal policy evaluator for the ARP Tool Registry.
Policy format
Top-level keys:
Version: optional version string.Statement: list of statements.
Statement keys:
Sid: optional statement id for audit/debug.Effect:AlloworDeny.Action: string or list of strings.Resource: string or list of strings.Condition: optional map of operator to key/value map.
Supported condition operators:
StringEqualsStringLike(wildcards with*)
Usage
from arp_policy import Enforcer, Policy, emit_decision
policy = Policy.load("./config/policy/policy.dev.json")
enforcer = Enforcer(policy)
context = {
"principal": "user:alice",
"tenant": "acme",
"environment": "dev",
"request_id": "req-123",
}
decision = enforcer.authorize("tool:Invoke", "tool:finance/pay", context)
if not decision.allowed:
raise Exception("policy denied")
# Audit event
record = emit_decision(
decision,
context,
action="tool:Invoke",
resource="tool:finance/pay",
policy_hash=policy.policy_hash,
)
Auth and identity
arp-policy is auth-agnostic. It does not validate credentials or issue identities.
The host service (Tool Registry, Runtime, Daemon) must:
- authenticate the caller using your chosen scheme (JWT, mTLS, API key, etc.)
- map verified identity attributes into the
contextdict (e.g.,principal,tenant) - avoid passing raw credentials into policy context
Tool discovery filtering
tools = [{"tool_id": "finance.pay", "metadata": {"labels": {"tier": "gold"}}}]
allowed = enforcer.filter_tools(tools, context)
Context keys
Typical keys used in policy conditions:
principaltenantenvironmentrequest_idtool.idtool.tags(tool labels/annotations)
Release files for arp-policy 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| arp_policy-0.1.2.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arp_policy-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:18.3 kB
Release files / arp_policy-0.1.2.tar.gz
| Download URL | arp_policy-0.1.2.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09ca84cfc54be14b12ea0c49b3622b2d75e678ad92f0fc511a94cf3f5f700e68
|
|
BLAKE2b-256 checksum How to use checksums |
6dcbfeacc463cf1758424c09876fb1cecfb497869f17623b5812befc3aae62ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 31, 2025.
Transparency logRelease files / arp_policy-0.1.2-py3-none-any.whl
| Download URL | arp_policy-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49a153edd06dcbf26ac20c520c4d9eb0f9fb3d04185ce3bc19c61fbcfab4bed4
|
|
BLAKE2b-256 checksum How to use checksums |
9fa686e807a21e49f39e3c5713486f64c099d94d08346e5df4b6405f5592a49b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 31, 2025.
Transparency log