Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 1 min read

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:

  1. Authenticate the session (cookie, token, whatever) to learn who is calling.
  2. Authorize the action + object on the server for that principal on every sensitive request β€” including ones that look β€œread-only.”
  3. 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.
  4. 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?”

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.