Files
gitea/api
officer 01e4210c62 sign the frame cookie instead of storing it
The minted tokens lived in an in-memory Map, so every restart of the platform
silently invalidated every open frame: the browser kept sending a cookie that
matched nothing and the frame answered 401 mid-session with "no gitea frame
session". Deploying anything at all logged everyone out of the iframe — which
is exactly how this was found, a restart landing between a sign-in and the POST
that followed it.

An HMAC over the account and an expiry needs no state, so a restart changes
nothing. Same shape api/browser/relay-auth.ts already uses, and the same key —
getKey('jwt') from the secret store, which persists.

Compared with timingSafeEqual, because comparing a signature with === leaks how
much of it was right.
2026-08-19 09:23:25 +00:00
..