A Session Security Checklist for Web Applications

A browser session lets an application recognize a signed-in account across requests. Review what happens from sign-in through sign-out and when a person's permissions change. This checklist focuses on web applications that keep session state on the server and use a cookie to carry the session identifier.

The browser session lifecycleA federated identity provider may maintain its own session, with separate sign-out behavior.
  1. Sign in

    Verify the account and issue a fresh opaque identifier.

  2. Protect the cookie

    Apply HTTPS, Secure, HttpOnly, and an explicit SameSite policy.

  3. Check requests

    Confirm the session is valid and evaluate current permissions.

  4. Reauthenticate

    Refresh authentication when required by time or action.

  5. End access

    Invalidate server state and clear the browser cookie at sign-out.

Map the session lifecycle

Identify the framework or provider responsible for sign-in and the service that maintains the application session. Map sign-in, the first authenticated request, any renewal, and sign-out. Add password reset, role changes, and account disablement. Decide which events end a single session and which require a review or revocation of other sessions for the account.

Use the framework's maintained session mechanism to issue an opaque, unpredictable identifier. Keep personal information in appropriate server-side records. Exclude session identifiers from URLs, application logs, traces, and error reports.

  • Use HTTPS throughout the session. Set Secure to restrict cookie transmission to secure connections and HttpOnly to keep it inaccessible to page scripts.
  • Limit the cookie to the intended host and path. A __Host- cookie uses Secure and Path=/ and omits the Domain attribute. Use it when that scope fits the application.
  • Set SameSite explicitly and test the chosen setting with supported sign-in and navigation flows. Use the framework's configured cross-site request forgery protection where cookie-authenticated actions change application state.
  • Issue a fresh identifier at sign-in and when the session's privileges change. Retire the former identifier and continue enforcing current authorization rules for protected actions.

Set time limits and define sign-out behavior

The inactivity limit measures time since qualifying user activity. The overall limit measures time since the last successful authentication or reauthentication. Enforce both through the session service. Choose values based on the application, the account's privileges, and any applicable assurance requirements. Define which actions reset the inactivity timer so background polling is handled as intended.

Make sign-out easy to find. Invalidate the session at the server and clear its cookie in the browser. Where sign-in relies on a separate identity provider, check whether application sign-out also ends the provider session. The provider and application can maintain independent sessions. Tell users which sessions their sign-out action ends.

Sensitive actions such as changing recovery details may require recent authentication alongside current authorization. Define who can revoke sessions after an account protection event and how long it should take for protected services to observe a revocation.

What ends a sessionTest each condition on its own and check the result on a fresh protected request.
  • Inactivity limit

    The session expires after too long without qualifying activity.

  • Overall limit

    The session reaches its allowed time since authentication or reauthentication.

  • Explicit sign-out

    The application closes its session at the user's request.

  • Operational revocation

    The account protection process ends the affected session scope.

Test the expected behavior before release

Use synthetic accounts in an approved environment. Check the cookie attributes and run the expected sign-in flow for each supported provider. With shortened test settings, verify inactivity expiry and overall expiry separately, including a session that remains active until it reaches its overall limit.

Sign out in one tab and confirm a fresh protected request in another tab using the same session requires sign-in. Use a separate test browser session to check what happens after account disablement, a role change, or explicit revocation. Record the expected outcome and its enforcing component. Review these checks when changing session stores, identity providers, or role handling.

Review authentication and authorization ยท Read about event logging and sensitive data

References