Session management (session timeout)
How an app keeps you signed in after login: the session token, cookie settings, idle and absolute timeouts, and logout that really ends access.
After login, the session token is as good as the password. OWASP’s Session Management Cheat Sheet lists the basics: a long random ID, a new ID after login, cookies marked Secure, HttpOnly and SameSite, never the token in a URL, and invalidation on the server at logout. A stateless JWT that cannot be revoked until it expires makes that last point harder.
Questionnaires ask “do sessions time out after inactivity?”. NIST SP 800-63B-4 (July 2025) suggests that at its middle assurance level, AAL2, reauthentication happen at most every 24 hours and after no more than one hour of inactivity. Pick values that fit your risk and write them down, so your answer matches the code. The SameSite attribute also helps against CSRF.
Sources
- OWASP: Session Management Cheat Sheet cheatsheetseries.owasp.org
- NIST: SP 800-63B-4, Digital Identity Guidelines: Authentication and Authenticator Management csrc.nist.gov
Related terms
- Authentication vs authorization (authn vs authz): Authentication proves who you are; authorization decides what you may do. Most access bugs live in the second, after a perfectly good login.
- JWT (JSON Web Token): A signed, compact token that carries claims about a user, such as who they are and when the token expires.
- CSRF (cross-site request forgery): Another site making a logged-in user’s browser send a request to your app, which the app trusts because the cookie came along.
- MFA (2FA, multi-factor authentication): Logging in with two or more kinds of proof, such as a password plus a code from an app or a security key.
- HTTP security headers: Response headers such as CSP, HSTS, X-Content-Type-Options and Referrer-Policy that tell browsers to apply extra protections to your site.
- OWASP ASVS (Application Security Verification Standard): An open checklist of security requirements for web apps and APIs, in three levels, used for design, testing and assessments such as CASA.
