A signed cookie is not object authorization
Signed cookies are great for integrity: the browser cannot silently rewrite a payload you sealed with a server secret. That still does not decide which objects the user may touch. Teams often stuff a user id, a role, or
Signed cookies are great for integrity: the browser cannot silently rewrite a payload you sealed with a server secret. That still does not decide which objects the user may touch.
Teams often stuff a user id, a role, or even a tenant id into a signed cookie and then treat βsignature validβ as βrequest authorized.β The cookie only proves the blob was minted by you. It does not prove the caller may read invoice #4821, mutate another userβs project, or act across tenants.
What to do instead:
- Authenticate the session (cookie, token, whatever) to learn who is calling.
- Authorize the action + object on the server for that principal on every sensitive request β including ones that look βread-only.β
- Never trust client-supplied ids just because they ride inside a signed envelope. Re-load the resource and check ownership/relationship/policy against the authenticated user.
- Keep cookies short-lived and rotatable; signature alone is not revocation or least privilege.
Quick check: change the object id in a still-valid signed cookie request. If the server returns another userβs data because the signature verified, you never had authorization β only a sealed identity claim.
Integrity answers βwas this tampered with?β Authorization answers βmay this user do this to this object?β
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.