Repository navigation
Review pages: optional password, expiry and revoke via caplinks - #90
Merged
Merged
Conversation
…off the loop, damaged-record revoke, 0600 temp files, lock-out tests
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.
Closes #88 (steps 1, 2 and the HTTP gate; steps 3 and 4 become follow-ups, below).
What: a review page can carry a password, an expiry and a revoke, on caplinks (merged and released as 0.0.3 first: i2mint/caplinks#2).
publish_review(..., password=, expires=)andheed review publish --password-file F --expires 7d,heed review revoke <id>. Page ids do not change: the record lives in<root>/access/<id>.json, and a page with no record stays open, exactly as before (no behaviour change, caplinks only imported when a record exists or is written).heed.review_access.ReviewGate(injectable viamake_review_app(gate=)): 401 untilPOST /pages/{id}/unlocksets a cookie (HttpOnly, SameSite=Strict, name = hash of the id, never past expiry), 410 expired, 404 revoked, 503 (closed) if caplinks is missing. Page, media and thread routes are all gated (make_thread_router(thread_gate=)is the one generic hook added). Wrong passwords: limited per client per page, and a page taking too many from everyone locks for a while.heed[gate]; README, skill and data-layout docs updated.read_cappedinheed.threadsis now public (it was_read_capped) to cap the unlock body.Adversarial review (fresh Opus agent), verdict "fix first", fixed: a publish with a bad password left an open page behind (validation now precedes saving); the cookie name carried the page id to every app on the origin (now a hash); scrypt ran on the event loop (threadpool); revoke crashed on a damaged record (replaced, closed); the temp file was briefly world-readable (mkstemp, 0600); ad hoc id check (now
valid_id); lock-out untested (tests added, plus bad-publish, cookie and damaged-record tests);access/added to the documented data layout. Judged fine and left:CapabilityLinksbuilt per request (cheap), per-process lock-out dict (at most one entry per gated page),SecurefromX-Forwarded-Proto(flag only), mediaCache-Controlup to an hour after a revoke.Tests: 28 in tests/test_review.py (all pass) plus doctests; the full suite passes except
tests/test_widget_browser.py, whose browser tests are flaky/failing on main too (one failed before this change).Follow-ups filed: per-page lock-out and the JSON-file record store into caplinks (steps 3, reviewer's note); dedup of the limiters is moot (
heed.securityalready adaptsenlace.ratelimit).