oliver-zehentleitner / maity
hub auth (R5 S185, medium): a signed request's nonce must stay spent when a later refusal rolls the request back (PostgreSQL)
tsk-ma0m1e00kb5d Open
Security round 5, finding S185 (MEDIUM), verified by red on a local PostgreSQL 16 at 921d88e4. Details went to the lead by DM; ask the lead or the purple lead (suqj).
Scope: hub/src/maity_hub/caller.py (around 436-447) spends the request nonce (nonces.first_use) on the auth connection, and deps.authenticated() runs the later refusals (isolation, the per-credential read limit, the confinement checks) in the same transaction. On PostgreSQL a refusal's rollback also undoes the spent nonce; on SQLite and MariaDB the in-process window keeps it spent, so the engines behave differently, and prod runs PostgreSQL. The code comment "Only a verified request spends its nonce" holds on SQLite only.
Done when: a verified request's nonce is spent in its own committed step (a separate transaction or a SAVEPOINT released before the refusals) on every engine, so the same signed bytes are refused as nonce_reused after any later refusal; a parity test runs the same sequence on SQLite and PostgreSQL (and MariaDB where CI has it) for each refusal kind (read limit, isolation, confinement); hub/context (auth) and docs/api.md (§ on request signing) say when a nonce counts as spent. Priority above the other R5 cards.