algovoi-waf
A semantic WAF for agentic / e-commerce payments. A fail-closed A2A JSON-RPC gate that sits between the world and an AI agent, immediately before canonicalisation in the Keystone spine. Pure Python, no required dependencies.
It answers one question for every inbound message: should this reach the agent? — and refuses with a stable, OWASP-mapped reject code when the answer is no.
What it stops
| Control | Reject code | OWASP |
|---|---|---|
| Prompt injection (patterns, homoglyph, base64) | REJECT_PROMPT_INJECTION |
LLM01:2025 Prompt Injection |
| Oversized prompt / task | REJECT_PROMPT_OVER_SIZE, REJECT_OVER_TASK_SIZE |
API4:2023 Unrestricted Resource Consumption |
| SSRF (private ranges, cloud metadata, scheme, host) | REJECT_SSRF_URL |
API7:2023 / A10:2021 SSRF |
| Unknown method / malformed JSON-RPC | REJECT_UNKNOWN_METHOD, REJECT_SCHEMA |
API8:2023 Security Misconfiguration |
| Unverified payment authorization | REJECT_UNVERIFIED_PAYMENT |
API3:2023 BOPLA / LLM06:2025 Excessive Agency |
| Stale / replayed payment authorization | REJECT_PAYMENT_EXPIRED |
API3:2023 BOPLA / LLM06:2025 Excessive Agency |
| Payment bound to different terms than demanded | REJECT_PAYMENT_MISMATCH |
API3:2023 BOPLA / LLM06:2025 Excessive Agency |
| Cross-tenant task access | REJECT_TENANCY |
API1:2023 BOLA / A01:2021 Broken Access Control |
| Rate / concurrency abuse | REJECT_OVER_RATE, REJECT_OVER_CONCURRENT |
API4:2023 Unrestricted Resource Consumption |
The full map is algovoi_waf.OWASP_CATEGORY and is re-published in the agent
card so coverage is auditable from outside the process.
The payment core
For agentic commerce, the WAF's job is to stop a payment authorization from
being used for something other than what it authorizes. check_payment
enforces, statelessly:
- presence + structure — a required reference must be present and fully
describable (
scheme,network,maxAmountRequired,payTo,asset); - freshness —
issuedAtwithinmax_payment_age_seconds, and not future-dated beyondpayment_clock_skew_seconds(replay / pre-signing defence, bothREJECT_PAYMENT_EXPIRED); - binding — the reference must match the terms the task demands: same
merchant (
payTo),network,asset, and an amount that covers the demand. A $0.001 authorization cannot settle a $1.00 cart; a valid authorization cannot be redirected to another merchant.
It does not settle, verify signatures, or touch a chain — that is the facilitator's job. The WAF binds intent to authority; settlement verifies it.
from algovoi_waf import gate_message, FirewallProfile, FirewallError
profile = FirewallProfile(require_payment_reference=True)
try:
gate_message(message, profile, now=time.time()) # True, or raises
except FirewallError as e:
print(e.code, e.owasp, e.detail)
Layers
gate.py— the stateless core (gate_message). No I/O, no identity, no clock unless you passnow. This is what the conformance vectors test.proxy.py— the stateful reverse proxy (FirewallProxy): adds tenancy (task ownership), per-caller token-bucket rate limiting, and per-caller in-flight concurrency limiting on top, then forwards to the agent. Wire it behind an auth proxy that sets the caller identity — the WAF consumes identity, it does not authenticate.scanner.py,validator.py,payment.py,concurrency.py— standalone, reusable checks.
Discoverability
algovoi-waf is a Keystone-discoverable app:
- Its policy is content-addressed:
profile_ref()returnssha256:…over the JCS (RFC 8785, rulejcs-rfc8785-v1) of the profile snapshot. Pin it; any policy change produces a new, auditable hash. The canonicaliser isalgovoi-substratewhen installed and a byte-identical stdlib fallback otherwise —tests/test_substrate_parity.pyenforces that both produce the same address, so a pinned reference never depends on the deployment. .well-known/agent-card.jsonis a standard A2A AgentCard advertising the skill, the pinnedprofile_ref, every reject code, and its OWASP mapping. It is generated bybuild_agent_card(profile)— the same builder the running app serves, so the checked-in file cannot drift from the live policy.
Run it
serve.py is a zero-dependency ASGI app. Point it at the protected agent and
run it under any ASGI server:
AGENT_URL=https://agent.internal uvicorn algovoi_waf.serve:app
GET /.well-known/agent-card.json— discoveryGET /healthz— livenessPOST /— gate an A2A JSON-RPC message, then forward to the agent
Caller identity is read from the X-Authenticated-Caller header, set by an
upstream auth proxy. Malformed JSON fails closed with a JSON-RPC parse error and
never reaches the agent.
Conformance
conformance/algovoi_waf_v1/ holds vectors.json (the pinned profile_ref +
snapshot and 23 accept/reject vectors) and verify.py, an independent
reimplementation of the gate — it does not import the package, so a single
implementation bug cannot make the vectors self-validating. It also re-derives
profile_ref from the snapshot.
python conformance/algovoi_waf_v1/verify.py # 24/24 (23 vectors + meta)
The stateful controls (rate, concurrency, tenancy) and the ASGI app are tested
under tests/ — they are not expressible as stateless message vectors:
python tests/test_concurrency.py # per-caller in-flight cap
python tests/test_serve.py # discovery + health + gate + forward
python tests/test_substrate_parity.py # profile_ref: real backend == fallback
License
Apache-2.0.
Metadata
Release files for algovoi-waf 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| algovoi_waf-0.1.0.tar.gz | 33.4 kB | Without provenance | Details for algovoi_waf-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| algovoi_waf-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for algovoi_waf-0.1.0-py3-none-any.whl |
Total release size: 71.8 kB
Release files / algovoi_waf-0.1.0.tar.gz
| Download URL | algovoi_waf-0.1.0.tar.gz |
|---|---|
| Size | 33.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e03427dba0d59c8cc1677631683eb85c64e58872c265ff57531494307cdb9e9f
|
|
BLAKE2b-256 checksum How to use checksums |
e6199532e2549f52b4a8241bae2f861b05bd7b06c54202a5bcd25f0d2cffe786
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / algovoi_waf-0.1.0-py3-none-any.whl
| Download URL | algovoi_waf-0.1.0-py3-none-any.whl |
|---|---|
| Size | 38.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1aac151607fa4fef6508ebb45363222850d6274543d8ff0f0da4efb87635fb3
|
|
BLAKE2b-256 checksum How to use checksums |
919bcbef6aa0d3cb73776cbd736cfe01a7cadfc304992cc2f0b55b04886904c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for algovoi-waf 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.