oliver-zehentleitner / maity
hub: auth: callers import single_use directly (drop email_links' re-exports and the alias test); registration through single_use.RequestLimits
tsk-w9wy6x7s3p5a Open
Audit round 3 (tsk-hgnbapyw7hnh), read at 588f911b. Kind: debt (compat path) / duplication / docs drift.
What is wrong
hub/src/maity_hub/auth/email_links.py:7-10and:29-36re-exportdigest,lock_human,recipient_over,Recipientand the fourRECIPIENT_*constants fromauth/single_use.py(its docstring:11: "keep their former names"). Callers still going through the shim:routes/password_reset.py:156,:212(email_links.lock_human);routes/registration.py:58-70,:216;notifications/address.py:29.hub/tests/test_single_use.py:204-211only asserts that the aliases are the same objects.hub/context/auth.md:985namesauth/email_links.py recipient_over, which lives insingle_use.py.hub/src/maity_hub/routes/registration.py:50-74defines nine module-level Limiters with exactly the numbers ofsingle_use.RequestLimits.__init__(auth/single_use.py:250-269: 10/h by source, 3 per 15 min and 10/day per pair, six recipient limiters), andregistration.py:209-228repeats the pair-then-recipient sequence ofRequestLimits.take(single_use.py:271-282).email_sign_inandpassword_resetalready use the class.
Proposal
- Import from
single_useat those callers; drop the re-exports and the alias test; fix the auth.md source line. Alpha: nobody depends on the old names. LIMITS = single_use.RequestLimits("routes.registration"), withtakesplit intotake_source()andtake_pair_and_recipient()(registration counts the source before scrypt and the rest in the background). Limiter names change, so in-flight counts reset once at deploy; say so in the PR.
Effort / risk: S-M. Low risk.