Repository navigation
v0.2.1
Released 2026-11-05.
A security-hardening and performance pass: the request-escape and header-echo
channels found in the audit are closed, rejection rows can no longer wash out
the forensic trail, and the audit write path shed its locks and clones.
Drop-in upgrade — no config or storage changes.
Security
- Request paths containing dot segments are refused with a 404 instead of
forwarded.build_upstream_urlconcatenated base + path verbatim, and the
downstream URL parser (reqwest/url) then removes dot segments while
resolving the final URL — soGET /../admin/xagainst a route with
base_url …/v1reached/admin/xupstream, and/v1/%2e%2e/xescaped the
same way (the RFC 3986 double-dot definition includes the%2evariants;
the WHATWG parser additionally treats\as a path separator for http(s)).
A vkey's reach is now the route's base_url prefix, matching what the docs
always implied. Locked in by a fuzz invariant that parses the built URL the
way reqwest will and asserts the resolved path stays inside the base
prefix, plus unit tests for every collapsible dot-segment form CONNECT/TRACE/TRACKare refused with a 405 (plusAllow). A TRACE the
upstream implements would echo the forwarded headers — the injected real
key included — back into the agent's view, the one channel that defeats the
"real key never reaches the agent" model; CONNECT was meaningless without
the already-refused Upgrade support- Rejection audit rows moved to their own rotation chain (
<audit-file>.rej,
5 × 10 MB). The per-fingerprint throttle keys on the rejected token's
fingerprint, so a flood of randomized fake vkeys evaded it entirely and
could rotate away the whole 60 MB forensic trail in ~35 minutes at the 100
rows/s global cap — the README claimed it couldn't, and that claim was
wrong. Rejections keep the same admission gates but can now only evict
their own chain; the main chain's line format is byte-identical for
existing consumers (therejectedflag is serialized only on the reject
chain)
Hardening
OPTIONS *(asterisk-form) is refused with a 400 client error instead of
surfacing as a 500configuration_errorfrom the URL builderanthropic-api-keyandopenai-api-keyare accepted as inbound vkey
headers, matching the outbound strip list: a client sending only one of
them used to get a misleading 401 while the gateway stripped the same
names on the way outKEYSINK_MASTER_KEY_FILEnow gets the same file checks as the default
vault.key: symlinks and group/other-readable identities are refused
(0400/0600 pass — systemdLoadCredentialcredentials qualify). The env
path used to skip both checks entirelydecryptcaps the ciphertext at 64 MiB before handing it to age. A
replacedvault.agealready implies a same-UID compromise (out of scope),
but age's reader grows the plaintext without bound; the cap keeps a wedged
hot reload from turning one bogus file into an OOMcreate_private_dir_allrefuses a pre-existing symlink instead of
resolving through it and landing the 0700 chmod on the symlink's target- The atomic-write temp name carries 8 random bytes instead of 4 — the old
65536-name space was predictable enough for a hostile local process to
pre-occupy and fail every vault write
Performance
- The audit write path is lock-free: the writer handle moved from
Mutex<Option<Writer>>to anArcSwapOptionsender, sois_enabled+
recordare two atomic loads per audited request instead of two mutex
acquisitions and a sender clone. The writer thread's join handle parks
beside the slot andclose()keeps its drain-then-join semantics (an
in-flight record holds the channel open through its own Arc, so tail rows
still land). Measured 7.7ms → 3.6ms for 5k records; the audit-on/audit-off
throughput gap narrowed from ~3% to ~1% - Timestamp rendering reuses the resolved UTC offset for one second: the time
crate re-readsTZ//etc/localtimeon everylocal_offset_atcall, which
used to run once per audit row and once per log line. Historical display
(ts) keeps per-instant resolution, so a DST switch can carry the
pre-switch offset for at most one second of rows — and the offset is part of
the rendered string, so every instant stays unambiguous either way - Rejected requests allocate nothing: method/path/query stay borrowed views
into the request parts, and the upstream key is read straight from the
snapshot's route table instead of cloned per request (accepted requests
clone only what goes on the wire) Authorization: Bearertolerates extra whitespace between the scheme and
the token (RFC 7235 wants exactly one SP; some clients send more). A glued
Bearer ks_…is still not recognized as the Bearer scheme- Dependencies: tokio's features narrowed from
fullto the set in use —
keepingparking_lotexplicitly, because dropping it with the rest of
fullmeasurably cost ~4% on the 80k-rps request ladder (tokio compiles its
runtime and sync primitives against parking_lot when the feature is
present); and fs2 (unmaintained) dropped for std'sFile::lock(stable
since 1.89, the same blocking exclusive flock on unix / LockFileEx on
windows), which also removes fs2's threewinapileftovers from the tree