GET /v1/receipts/:request_id (require_ingress_or_admin_key) still accepted
the bare ABACUS_API_KEY directly with zero per-agent binding, documented at
the time as an intentional exception to the 2026-11-05 per-agent-key fix
(f4fb4fb3/7119565f) that scoped /v1/proxy and /v1/budget. Two real problems:
anyone holding the master secret (meant only for deriving per-agent keys)
got full cross-agent receipt visibility, widening that secret's blast
radius beyond ABACUS_ADMIN_API_KEY's intended scope; and a properly
provisioned agent -- which per the per-agent model only ever holds its OWN
derived key, never the master secret -- could not use the endpoint its own
doc comment says exists for "an agent reading its own spend."
require_ingress_or_admin_key now accepts the same per-agent derived key
require_api_key does (bound to X-Abacus-Agent) or the admin key; the bare
master secret no longer authenticates any route directly. get_receipt adds
an ownership check (receipt.agent_id must match the authenticated agent,
unless admin), with a mismatch reporting the same 404 as "never existed" --
no cross-agent request-id enumeration.
cargo build --workspace clean; full workspace test suite green including 3
new regression tests (cross-agent denial, admin cross-agent read, bare
master key rejected); cargo clippy -p abacus-proxy --all-targets -D warnings
confirmed pre-existing-only (git stash/clippy/pop) on hold_reaper.rs, untouched
by this diff.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
README still described X-API-Key as the single ABACUS_API_KEY secret clients
present directly — now explains the per-agent derived-key contract added by
the require_api_key fix (formula, an openssl one-liner against the example
agent, and which routes still take the bare master key).
Also fixes the "Full plan" link to docs/apps-vision/abacus.md: that file does
not exist and has no history anywhere in this repo (git log --all turns up
nothing), so the link was dead. Replaced with an honest pointer to this
README plus the owner's cross-portfolio plans/railyard.md instead of
fabricating a vision doc that was never written.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ABACUS_API_KEY was ONE shared ingress secret for the whole deployment: any
caller holding it could set X-Abacus-Agent to a DIFFERENT configured agent's
id and spend from that agent's treasury/allowance under that agent's own
per_request_max_micros (handler.rs run_flow, admin.rs::own_budget), or read
its budget policy/live allowance headroom via GET /v1/budget — isolation only
existed between the deployment and the outside world, never between agents.
require_api_key now recomputes hex(HMAC-SHA256(ABACUS_API_KEY, agent_id)) for
the X-Abacus-Agent the caller claims and compares it, constant-time, to the
presented X-API-Key. The operator keeps ABACUS_API_KEY to itself and issues
each agent only its own derived key, so an agent that knows only its key
cannot derive (or forge) another agent's — HMAC preimage resistance — closing
the cross-agent impersonation hole at the auth layer, before LocalStore's or
PostgresProductStore's resolve() ever runs its bare agent_id lookup.
Verified against the real build_router (not a stub): a throwaway example
wired FakeBudgetRepo with two agents and proved agent A's derived key is
rejected (401) when claiming to be agent B, the raw master key alone is
rejected (401) on agent-scoped routes, and A's own key + own id still works
(200) — then the example was deleted before this commit per no-test-files.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Both already had compose profiles, Caddy site files and a reserved Postgres
role/db from an earlier next-wave prep -- just never filled in, built or
started. Wired real Mint accounts (payee address for Turnstile; agent,
treasury and provider payee for Abacus), real admin/API tokens, and real
relay-priced config, then built and started both containers for the first
time. Added public DNS A records via the real write-scoped
CLOUDFLARE_DNS_API_TOKEN and enabled both Caddy sites.
Verified live end-to-end against the real deployed containers, on loopback
and over the real public hostname: Turnstile's unpaid POST /v1/echo and MCP
tools/call both return a real 402/-32402 AITP challenge with the real payee;
Abacus's real agent correctly 402s insufficient_funds against the real
zero-balance Mint treasury (cross-checked directly against Mint's own
balance endpoint) and the kill switch rejects an over-cap request with zero
Mint calls (confirmed via /v1/admin/overview before/after).
No application code changed -- the deploy itself is ops on railyard-box
(/etc/products/{turnstile,abacus}.env, /srv/railyard/{turnstile,abacus}/*.json),
not tracked in this git repo. Docs-only commit.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- apps/{vend,turnstile,abacus}/Dockerfile.dockerignore: per-Dockerfile ignore
files so repo-root builds upload only the workspaces they compile
- apps/relay/ui/Dockerfile.dockerignore: the gateway .dockerignore excludes ui/
and pnpm-lock.yaml, which the Relay UI image needs
- apps/vend/Dockerfile: copy apps/mint (vend-mint-client path-depends on
mint-core/mint-protocol); the builder stage failed without it
- apps/DEPLOY-SHARED-PLANE.md: rewritten to match infra-box
stacks/railyard/docker-compose.yml (docker compose profiles, host ports
3100-4000, one Postgres with Relay observability in Postgres, no ClickHouse,
abacus + relay-ui, env matrix, basic_auth/SSH access for the console)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- vend-server GET /admin: tenants/apps/keys/usage/users via existing /v1/control (Bearer admin token)
- abacus-proxy GET /admin: receipt lookup by request_id (X-API-Key; only authed read endpoint — labeled)
- turnstile-demo GET /admin: tool catalog + settlement lookup (open endpoints; no challenge-list — labeled)
- same include_str! vanilla-JS pattern as rago /admin; HTML-escaped; noindex; no new auth path
- honest: surfaced only real endpoints, no fabricated views; cargo check 0 all three
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When an enforced request succeeds but its actual cost exceeds the priced
est_max reserve, settle() passed the over-estimate straight to
capture_hold, which Mint rejects with CaptureExceedsHold. That error
escaped before the HoldGuard was disarmed, aborting settlement: the hold
was stranded armed, no receipt was written, and the agent was billed
nothing for a successful call (the reaper later released the hold for
free) — a metering/revenue-leak bug. Actual can legitimately exceed the
reserve because the prompt-token estimate is a chars/4 heuristic and the
default completion ceiling can under-count real usage.
Clamp the capture to guard.reserved_micros: bill up to the reserved
ceiling (never more — it is physically held, never zero), warn on the
under-reservation so pricing can be revisited, and let the successful
response settle normally. Adds regression tests for the over-reserve and
under-reserve capture paths against the invariant-enforcing fake Mint.