Repository navigation
v0.1.4
Released 2026-11-03.
A stability, security and throughput pass: a long-running gateway no longer
creeps up in memory, every request phase is bounded, and the hot path allocates
less per request, per streamed chunk and per forwarded header. Drop-in upgrade —
no config or storage changes.
Stability
- The serve loop now reaps finished connection tasks as they finish (a join
branch in the accept select). tokio's JoinSet retains every finished task's
entry untiljoin_nextconsumes it, and it was only joined after the
accept loop broke — so memory grew with the cumulative number of accepted
connections over the process lifetime, a few KB per reconnect, even though
concurrency stayed flat. A long-running gateway slowly ate its own RSS - Request-head screening (missing/unknown vkey, disabled route, oversized
declared Content-Length) now happens before the inbound permit is acquired.
With the permit first, a credential-less flood could pin every permit for
the body-read timeout each and starve legitimate traffic while it queued.
Queueing for a permit is also bounded (PERMIT_QUEUE_TIMEOUT, 30s): a
wedged upstream that accepts TCP but never sends response headers holds
every permit for up to attempts × header_timeout + backoff, and the
open-ended queue hung agents with no server-side error at all — past the
bound requests are shed with 503 +Retry-After: 1 - Descriptor-pressure accept errors back off on Windows too
(WSAEMFILE/WSAENOBUFS, previously Unix-only EMFILE/ENFILE — any other
transient error aborted the whole serve loop there), the 1s backoff sleep
is interruptible by shutdown, and accepted sockets get a 60s TCP keepalive
as dead-peer insurance - Graceful shutdown logs how many connections are still draining, and a
second SIGINT/SIGTERM exits immediately with code 130: tokio's libc signal
handler stays registered after the shutdown future resolves, so further
signals were silently swallowed by a broadcast with no receivers and a
long-lived SSE stream could pin the drain until SIGKILL - The audit writer's reopen path no longer asserts an internal invariant
withunwrap
Security
- Inbound h2c connections are now keep-alive-probed: the server PINGs after
30s of silence and closes the connection when the PING is not ACKed within
15s. The http1 slowloris bound (header_read_timeout) never reached h2
connections, so an established-but-silent h2 connection held its connection
slot forever — silently parking max_connections of them was a one-shot
remote denial of service on an--allow-remotedeployment. A peer that
answers the PINGs is actively maintaining the connection and is unaffected - Starting
serveon the.bakbackup (primary store undecryptable) now
prints a prominent stderr banner with the recovery commands and, on a TTY,
asks for confirmation — the backup lags one write behind, so vkeys rotated
or removed since that write would silently work again. Non-interactive
runs (systemd) keep starting for availability, banner and all;
--accept-degradedskips the prompt - The audit log now keeps 5 rotated generations (
.1….5, previously
just.1), and rejected requests (401/403/408/413/…) pass an admission
gate: one row per second per vkey fingerprint, 100 rows per second
overall, suppressions counted in the log. Rejection rows are the one audit
input an unauthenticated peer controls, and at loopback speeds a flood
used to rotate a whole generation away in about a minute exportoutput now states that the backup carries the working vkeys of
every route (it always did; the reminder makes the storage requirement
explicit), andinit --forcelists the leftovervault.key.old.*/
vault.age.old.*pairs — each old key still decrypts its old store, so a
rebuild done to flush a compromise is not complete until they are deleted
Performance
- The per-request "forwarding request" log line is now
debuginstead of
info: at ~60k RPS the info line wrote ~12MB/s of log (6.4GB over a
10-minute soak) and its formatting plus stdout-lock cost measurably capped
throughput. The audit log (--audit-log) remains the per-request record;
RUST_LOG=keysink=debugrestores the line for troubleshooting — update any
monitoring that counted these lines - With audit off (the default), successful requests no longer construct an
audit entry at all: the entry's RFC3339 local-time format and its handful
of String allocations were pure waste on that path; anis_enabled()
check (the writer is fixed at startup, so it cannot flip mid-request)
skips them - SSE terminator scanning no longer allocates per chunk: the scan state moved
into the response stream itself, each upstream chunk is now searched in
place, and a fixed 40-byte stack window catches markers split across chunk
boundaries. Previously every chunk of every stream cloned the request id
String, locked a carry mutex, and copied carry + chunk into a fresh Vec —
every stream byte copied twice. Marker detection is unit-tested at every
split point, including byte-by-byte arrival, and the searched needles are
asserted against the window size so a future longer needle cannot silently
blind the boundary check - Upstream response headers are now moved out of the response, hop-by-hop
entries dropped in place, and the map moved whole into the client response;
the old path cloned every header twice (once into a fresh HeaderMap, again
through the response builder)
Timestamps
route show'screated:, the audit log'stsand the log-line prefixes are
now rendered in the system's local time zone with an explicit offset
(2026-11-02T17:46:16+08:00) instead of always UTC, so they match the wall
clock on the machine that wrote them. The offset is resolved per instant, so
entries written across a DST change keep the right offset. Storage is
unchanged (epoch seconds);TZ=UTCrestores the old output, and an
unresolvable zone falls back to UTC rather than dropping the line
Dependencies
cc1.10.0 → 1.11.0 andctutils0.4.7 → 0.4.8 (transitive patch updates)