oliver-zehentleitner / maity
hub: auth: the second_factor leftovers tsk-j967n09yz6ps kept for after #1756 (admins rule x3, _handle reach-in, address_of, recovery-code alphabet, dead DUMMY_HASH half, EMPTY_BODY_SHA256)
tsk-5ey8p2s2dq5w Open
Audit round 3b (tsk-hgnbapyw7hnh), read at 80fef076. Kind: duplication / dead code / leftover compatibility.
tsk-j967n09yz6ps is done, but its commit d2131073 (#1788) left several items "after #1756"; #1756 merged (840ad942) and no open card holds them. tsk-ee3z4rakddq9 points second_factor._handle at j967 item 8, a closed card.
What is still there
- The "
required_adminsand (instance admin or owns a project)" rule three times:hub/src/maity_hub/auth/second_factor.py:143-145,:919-921,:970-971. - Private
second_factor._handle(:990-991) called fromauth/second_factor_reset.py:111, 172, 191; an inline copy atsecond_factor.py:834. mail_factor.address_of(auth/mail_factor.py:60-63), a wrapper ofverified_row"kept for second_factor ... after #1756"; callerssecond_factor.py:138, 650,tests/test_mail_factor.py:690.- Recovery codes keep their own Crockford alphabet and reading rule (
second_factor.py:61-62, 356-361, 366) besidecodes.ALPHABET,codes.random_code,codes.normalise(codes.py:22-51). has_password(second_factor.py:794): the!= passwords.DUMMY_HASHhalf is always true;DUMMY_HASHis made per process (passwords.py:59) and never stored.credentials.EMPTY_BODY_SHA256(auth/credentials.py:27) has no reader in hub/, cli/ or web/.mail_factor.py:167is a no-op:method="password" if row.method == "password" else row.method.
Proposal
- One
_admins_must_have_it(conn, hub, human_id); the public handle helper of tsk-ee3z4rakddq9 (and fix that card's pointer); inlineverified_row, dropaddress_of; recovery codes throughcodes.random_code/codes.normalise(code, 10)plus.lower()so stored hashes stay valid; delete theDUMMY_HASHhalf,EMPTY_BODY_SHA256and the no-op.
Effort / risk: S. Low; the recovery-code reading must keep today's lower-case form or every stored code stops working.