Files
pad/internal/server
xarmian c03a4851bd fix(server,redisns): two codex round-3 findings — DoS via legacy tokens, blank namespace (BUG-2724, BUG-2726)
1. Callers with no user id skipped the per-user bound entirely, so one
   legacy workspace-scoped token could fill the global budget and 429
   everyone else — a denial of service through a deprecated auth path.
   My own comment argued for the skip on the grounds that bucketing every
   anonymous caller under one empty string would make unrelated callers
   evict each other. That was right about the empty-string bucket and
   wrong about the conclusion: the fix is a better key, not no key. They
   are now bucketed by workspace, the finest granularity actually
   available — from the token's own workspace id where it has one, from
   the resolved workspace otherwise. The residual trade (two legacy
   tokens for one workspace share a bucket) is stated in the code and in
   the docs rather than left for a reader to discover.

2. PAD_REDIS_NAMESPACE=" " trimmed to Default, so a broken template
   substitution silently restored the historical keyspace and collided
   with the installation the namespace was set to separate from — the
   exact leak, arriving through the mechanism meant to prevent it. Only a
   genuinely unset value is Default now; whitespace-only is a startup
   error naming both alternatives.

The first fix needed a second instrument. Mutating the handler to pass
currentUserID instead of streamPrincipal SURVIVED the unit tests, which
drive the helper directly — the same defect shape as day-49's batch-id
finding: testing a knob at the layer that consumes it proves the knob,
while the caller passing it is a separate claim. The new handler-level
test drives the fresh-install no-auth window through HTTP and fails by
name when that wiring is reverted.

Claude-Session: https://claude.ai/code/session_01JVDBKbgn3Xt7ndW1YoYd8X
2026-08-22 02:15:50 +00:00
..