Tool index

Runbook: Manage Browser Cookies and Sessions Safely

A security runbook for keeping browser cookies and sessions isolated, reducing exposure, documenting ownership, and responding to a suspected compromise.

OpSecAntidetect

Core rule: an authenticated browser profile can contain session cookies that let its holder act as the account. Treat profile folders, browser sync, cookie exports, crash dumps, and screenshots as credential-bearing data. This runbook is for accounts you own or are authorized to support.

1. Create an ownership and access record

Record the account owner, approved operators, business purpose, recovery contact, approved browser/device, and review date. Prefer named seats or delegated access provided by the service. Do not copy a colleague’s live session to avoid the service’s own login or access workflow.

Limit who can open the operating-system account and the browser profile directory. Use individual OS logins, disk encryption, automatic screen lock, current endpoint protection, and least-privilege roles. Remove access promptly when an operator leaves or a client engagement ends.

2. Keep session material out of shared systems

  • Do not paste cookies, browser storage exports, refresh tokens, or recovery codes into tickets, chat, spreadsheets, email, or Git.
  • Exclude browser profile directories, Playwright storage-state files, and debug traces from source control and routine cloud sync.
  • If an authorized test requires a state file, use synthetic accounts, encrypt the file at rest and in transit, scope access to named testers, set a deletion deadline, and revoke the test session afterwards.
  • Redact authorization headers, cookie headers, QR codes, backup codes, and account identifiers from screenshots and logs.

OWASP recommends protecting session IDs as credentials and warns against placing authentication tokens in browser localStorage or sessionStorage when an HttpOnly cookie or backend-held pattern is available. See the OWASP Session Management Cheat Sheet.

3. Set application cookies securely (for site operators)

If you control the web application, set session cookies only over HTTPS with Secure, HttpOnly, and an explicit SameSite=Lax or Strict policy appropriate to the login flow. Use short, risk-appropriate expiry, rotate the session after login/privilege changes, invalidate it server-side at logout, and never put session IDs in URLs. Test SSO, payment, and cross-site callbacks before choosing Strict.

Example for a first-party session where the flow permits it:

Set-Cookie: __Host-SessionID=<random-value>; Path=/; Secure; HttpOnly; SameSite=Lax

This header is for developers configuring their own application. A browser user cannot safely repair a service’s cookie policy from the client side; report a problem to that service instead.

4. Operate profiles without sharing sessions

Keep each authorized test or business workspace labeled by real owner and purpose. Use the service’s normal sign-in, MFA, and recovery flow in each approved workspace. Do not move cookies between unrelated accounts or profiles, and do not assume a profile manager encrypts every local, synced, or backup copy. Confirm its storage, sync, access-control, and deletion behavior with the vendor.

At offboarding, remove the operator’s access in the service itself, revoke active sessions, remove local profile access, and confirm that authorized records remain with the account owner. Deleting a local cookie alone may not invalidate a copied server-side session token.

5. Respond to suspected exposure

  1. Stop using the affected profile and alert the account owner through a trusted channel.
  2. From a clean trusted device, revoke active sessions and rotate the password or recovery method if exposed.
  3. Review recent sign-ins, API keys, billing changes, and account actions; preserve sanitized timestamps and events.
  4. Remove exposed files from shared storage and repository history where applicable; do not re-share the token to prove exposure.
  5. Re-enroll MFA/passkeys and reauthenticate through the official service flow.
  6. Document scope, affected accounts, actions taken, and follow-up owners.

Completion checklist

  • Account owner and operators are documented; all access is authorized.
  • MFA/recovery methods are controlled by the owner, not an ex-operator.
  • Profile folders and state files are encrypted, access-controlled, excluded from Git, and backed up only when required.
  • No active cookies or tokens appear in logs, screenshots, tickets, or chat.
  • Offboarding and session revocation were tested using a non-production account.

Related: multi-account operations guide, Browser Leak Check, and editorial methodology.

Source and scope

Application session recommendations checked December 6, 2026: OWASP Session Management Cheat Sheet. Apply the service’s own terms, incident policy, and applicable privacy requirements.

Common questions

Are browser cookies passwords?

An authenticated session cookie can function as a bearer credential: someone who obtains a valid value may be able to act as the signed-in user. Protect active cookies with the same care as passwords and recovery codes.

Is it safe to export cookies to move a profile?

An export may contain live session credentials. Use the platform's approved transfer or reauthentication workflow instead. If an export is required for authorized QA, use synthetic test accounts, an encrypted approved location, a narrow access window, and delete it after the test.

What should I do if a browser session may be exposed?

From a trusted device, revoke active sessions using the service's security controls, rotate the account password and recovery credentials if needed, enable MFA, notify the owner, and record the incident without copying the exposed cookie into a report.