diff options
| author | aur-build <aur-build@localhost> | 2026-11-18 14:41:45 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-18 14:41:45 +0000 |
| commit | 3370a487d6e1100623ebfd982967f1223d251607 (patch) | |
| tree | 124db2f1fe41c3835b4aa4f39a980200804202ea /src/watch/detect.rs | |
| parent | 157c078e52fee6c37ff20093189ae7ad7cd223cb (diff) | |
| download | aur-build-3370a487d6e1100623ebfd982967f1223d251607.tar.gz aur-build-3370a487d6e1100623ebfd982967f1223d251607.zip | |
http: the session id is the credential, not a cookie a client can type
The gate asked whether the request carried `Cookie: auth=1`, and login did
nothing but set that literal value, so the password protected the login form
and nothing else: anyone could read the reviews, the audit log, the settings
and the build logs by typing the cookie themselves, and the CSRF step then
happily minted them a session to POST with. The random sid machinery was
already there and already unguessable; it was just never bound to the flag
that said "someone authenticated".
A session now carries that flag. `auth.rs` holds a map of live sids to
whether they passed the password gate; `authenticate` can only flip a sid this
process minted, so a login attempt cannot mint a session as a side effect.
`gate` asks `is_authenticated(sid)` and nothing else, and the `auth` cookie is
gone from both the login response and the logout one. Login rotates the sid
rather than promoting the anonymous one, so the session that existed before
the password was typed is never the one that carries the privilege after it;
logout drops the sid, which invalidates its derived CSRF token with it.
Two tests, both over a bare socket because a client that follows redirects
turns "you are not signed in" into the login page's 200 and hides the whole
point: `a_forged_auth_cookie_is_not_a_session` (the exact forgery, on every
sensitive surface, GET and POST) and `login_rotates_the_session_and_logout_ends_it`
(rotation, dead pre-login sid, dead logged-out sid). The audit actor is
honest now too: with a password set, only an authenticated session is "web".
Diffstat (limited to 'src/watch/detect.rs')
0 files changed, 0 insertions, 0 deletions
