Repository navigation
fix: stop anonymous session rows, ignore import/, cover risky paths with tests - #12
Merged
Merged
Conversation
…ith tests - Sessions: drop with_always_save. It saved a new empty row for every unknown session cookie on responses that never read the session (static files, 403 origin refusals, 405), each kept 30 days. Ctx now slides the 30-day expiry for logged-in players only, and abandoned OAuth logins expire after 10 minutes. - Ignore import/ in git and Docker: it holds the original photos, whose EXIF time and GPS are the answers, and the v1 users export. - Tests: the OAuth callback refuses a missing, wrong or reused state without contacting the provider; picture import/edit keep the answer once players guessed; every edition has a name in the locales. - The day page's picture URL carries the file name, so a replaced picture is not served from the one-day browser cache. - Home and profile query only the player's own guesses. - The profile reuses Provider::label instead of a second list of names. Co-Authored-By: lazytrek <352825308+lazytrek@users.noreply.github.com>
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.
Fixes from a pre-launch audit. Internal only: no changelog entry, version stays 2.0.0.
Must fix
Unknown session cookies created database rows.
with_always_save(true)saves the session on every response. When a request carries a session id the store doesn't know and the handler never reads the session, tower-sessions creates a brand-new empty row. That happened for/static/*, POSTs refused by the origin check (403) and wrong methods (405). Each row lived 30 days, and no login was needed: 5 requests with a made-up cookie gave 5 rows.with_always_saveremoved.Ctxsets the 30-dayOnInactivityexpiry only when a player is logged in, so their window still slides.oauth_startsaves with a 10-minute expiry, so abandoned OAuth logins are cleaned up within the hour.Should fix
import/is ignored in.gitignoreand.dockerignore. It holds the original photos, whose EXIF time and GPS are the answers, and it sits inside a public repo.state, and sends nothing to the provider. A local listener catches any outgoing request.picture importandpicture edit --timerefuse to change an answer once players guessed.--forcestill works, and hints stay editable.EDITIONShas anedition.y<year>name. The README step for adding a year now mentions it.Nice to have
/day/N/picture?v=<file>, so re-importing a picture after unlock skips the one-day browser cache.db::user_guessesquery instead of loading every guess of the edition.Provider::labelinstead of a second list of provider names.Test plan
cargo fmt --check,cargo clippy --all-targets --locked -- -D warnings,cargo test --locked: 35 passuser_idfilter droppedCo-Authored-By: lazytrek 352825308+lazytrek@users.noreply.github.com