Engineering Auth Sessions

Session Management Review Prompt

Review the session lifecycle for the classic holes — fixation, weak expiry, missing rotation, insecure cookies, and sessions that outlive a logout or password change.

Overview

Sessions are where auth quietly breaks: a token that never expires, a session that survives a password reset, a cookie missing HttpOnly. This prompt reviews the session lifecycle end to end — creation, storage, expiry, rotation on privilege change, invalidation on logout and password change, and cookie security — against the well-known failure modes.

How to use this resource

  1. Gather the session lifecycle code

    Collect the code that creates, stores, expires, and invalidates sessions, plus the cookie settings. The review walks the lifecycle end to end.

  2. Open this resource in Code Review Prompt Generator

    Load the prompt into Code Review Prompt Generator and paste in the session code. It reviews for fixation, weak expiry, missing rotation, and insecure cookies.

  3. Review the session findings

    Read each finding - a session that outlives a logout or password change, a token that never expires, a cookie missing HttpOnly - against the known failure modes.

  4. Fix the holes and re-review

    Close the flagged issues, especially rotation on privilege change and invalidation on logout, then re-run the review to confirm the lifecycle is tight.

Why This Works

  • The session lifecycle is where most real auth bugs live
  • A checklist catches the invalidation-on-password-change gap teams routinely miss
  • Cookie-flag and fixation checks are cheap to run and expensive to skip

Best for

  • Any app with logged-in sessions
  • Code after an auth change or library upgrade
  • Apps handling sensitive accounts

Not for

  • Choosing the auth mechanism — use the Authentication Strategy Prompt
  • Reviewing JWT-specific issues — use the JWT Security Review Prompt

Use cases

  • Reviewing session handling before a release
  • Checking that sessions die on logout and password change
  • Auditing cookie flags and session expiry

FAQ

How does an AI session review flag which issues are most serious

The SEVERITY section tags each finding [CRITICAL], [MAJOR], or [MINOR], and states that sessions surviving a password reset, or fixation, are CRITICAL. Code Review Prompt Generator produces this review prompt; you run it in your own assistant. Treat the output as a review to verify, not a security audit or a guarantee that every session hole was caught.

What session lifecycle stages does this prompt actually check

Seven, walked in order: FIXATION (fresh ID on login), EXPIRY (absolute and idle timeout), ROTATION on privilege change, INVALIDATION on logout and password change, STORAGE safety, COOKIE FLAGS, and CONCURRENCY including log out everywhere. It reviews the lifecycle code you paste and returns findings with locations; confirming and fixing them stays your responsibility.

When should I use the JWT review instead of this session prompt

Use a JWT-specific review for token-signature and claims issues; the notFor sends you to the JWT Security Review Prompt for those. This one targets the server-side session lifecycle instead, checking INVALIDATION on logout and where STORAGE lives. Choosing the auth mechanism is also out of scope, and the output is a review recommendation, not a validated sign-off.

More resources from Code Review Prompt Generator

Resources that pair well

Related tools

Guides for this resource

Tip: Save time by exploring related resources and tools that integrate with this resource.