Repository navigation
Gate an existing id: create(token=), set_password, set_expires - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Additive, for i2mint/heed#88: heed's review page ids must not change, so a link can now be made over an id the host already has.
create(..., token=): validated withcheck_token, refused if a link already has it.set_password(token, pw | None)andset_expires(token, when)change a live link; a revoked one stays revoked (KeyError); a new password ends every open unlock (HMAC keyed by the hash).Tests added (52 pass with doctests, ruff clean). Review: additive API only, no behaviour change to existing calls (self-review suffices; no new surface, no dependency).
Adversarial review (fresh Opus agent): verdict "fix first", all confirmed and fixed: (1)
set_*could undo a concurrent revoke, so the record is now read right before the write via one_update(the residual window of a store with no compare-and-set is documented; multi-worker hosts serialise writes per token); (2)create(token=)overwrote a damaged record, so it now checkstoken in store; (3) caller owns the id's randomness, said in the docstring; tests added for the revoked-id, new-password, past-date, missing-token and damaged-record cases. Cut: duplicated hash/length code folded into_hash_password.