5719e51e
login: ecore's cookie decoder, which validates the name ours did not
authz/identity.go was the fifth copy of a decode the instance has one of, and it was one of the two that validated nothing: whatever name a sealed payload carried went on to the GraphQL viewer field, the chrome's nav and every log line the request produced. login.ValidName refuses it, and there is no spelling of the API that turns the check off. Gone with it: CookieName, UsernameFromRequest, Middleware, ForContext and the ctxKey, plus identity_test.go, whose round-trip, tilde-stripping and garbage-cookie cases are ecore's tests now. The Middleware becomes login.Optional() — this service refuses nobody, git.sr.ht decides what an anonymous viewer may see — and the default validator is kept rather than core.ValidOwner, which is lowercase-only and would log a real account out of compare alone. The one behaviour change a viewer could notice: a cookie whose name carries a '/', a control byte or a non-ASCII letter now reads as anonymous instead of as that name.
bigbes <bigbes@gmail.com> — 2026-08-08 21:17:57 UTC
Commit 5719e51eb3dce09b2a9bfeddde7e8202c0a606cc —
view raw patch
Parent(s):
4cc56fcd
| File | Status | + | − |
|---|---|---|---|
README.md
|
M | +4 | -2 |
authz/authz_test.go
|
M | +9 | |
authz/doc.go
|
M | +7 | -6 |
authz/identity.go
|
D | -63 | |
authz/identity_test.go
|
D | -98 | |
cmd/comparesrht/main.go
|
M | +6 | -2 |
docs/inline-comments.md
|
M | +3 | -2 |
web/handlers.go
|
M | +3 | -2 |
web/server.go
|
M | +13 | -7 |
web/web_test.go
|
M | +8 | -6 |