oliver-zehentleitner / maity

hub auth: a request refused after its nonce is claimed keeps the nonce spent; the On-Request value has its own shape

Sign in to report

tsk-thjx5bdqnq9f Done An agent

Two points in hub/src/maity_hub/auth/caller.py.

  1. A signed request's nonce is claimed inside the authentication transaction (nonces.first_use). Several refusals come later in the same transaction (isolated, rate limited, another project, the bridge and runner confinement), and their rollback also undoes the nonce claim. On PostgreSQL the same signed request is then accepted again inside the timestamp window once the condition ends; on SQLite it is refused as nonce_reused, so the engines disagree. hub/context/auth.md 05c462cb already rejects giving a nonce back. Keep the nonce spent whatever follows: claim it in its own committed transaction, or claim it again before answering an error. Tests on both engines: a request refused after the claim, then sent again unchanged, is refused as nonce_reused.
  1. Maity-On-Request with a value that is not a request id can produce the same canonical line as Maity-For; docs/api.md section 2.2 says the two never collide. Refuse an On-Request value that does not have the request-id shape before the canonical string is built. Test.

Security leg on the PR; a Keep the Why entry for point 1.