SECURITY ENGINEERING, IN PRACTICE.ANALYSIS / TECHNICAL NOTES / FIELD NOTES
Packet Notes.

Clear thinking on software,
infrastructure and security.

Technical note

Review the cookie context of a state change

A request can carry ambient credentials without expressing the user’s intent.

Start with the operation

OWASP recommends CSRF defenses for state-changing requests and treats SameSite cookies as defense in depth. Same-site and same-origin are different boundaries; a cookie setting alone is not a complete account of which requests the application should trust.

List the operations that change an account, grant access or initiate work. For each, record how the server distinguishes an intended action from a request that merely arrives with the browser’s cookies. Avoid state changes through GET links.

Make a review matrix

For an original exercise, choose a harmless display-name change. Compare the normal application flow with a missing CSRF token, a token from another session and an unexpected request origin. Specify the expected rejection before running each case. Keep the authentication result separate from the CSRF result so a logged-out rejection cannot accidentally stand in for evidence about a logged-in request.

Include alternate routes such as older forms and mobile web views in the inventory. A new JSON endpoint does not automatically remove an older form endpoint that performs the same action.

Document the chosen mechanism

Our recommendation is to record the framework’s protection mechanism, how templates or clients obtain its value and where the server validates it. Review exemptions individually, including the reason and replacement protection. Treat an origin check, a synchronizer token and a cookie attribute as specific mechanisms with different assumptions; do not collapse them into a checkbox labeled browser security.

Source & further reading

OWASP · CSRF Prevention Cheat Sheet ↗