agentsclimarketplace

Session management

Skill Amey-Thakur/AI-SKILLS/skills/security/session-management

Plug-and-play skills and prompts for every AI coding agent

Install
npx -y skills add Amey-Thakur/AI-SKILLS --skill session-management

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 19 days oldThe repository was created 19 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Handle sessions so identifiers rotate on privilege change, expire on inactivity, can be revoked server-side, and ride only on hardened cookies. Use when issuing, storing, or validating session tokens after a user signs in.

SKILL.md

3.0 KB, as published. Nobody here has run it

Session management

A session is the credential a user carries after login, so a stolen or stale session is a stolen identity. The dangers are a token that never dies, one that survives a password change, and one exposed to script or sent in the clear. Good session handling is about controlling the token's lifetime and reach.

Method

  1. Set the cookie flags that lock the token down. Mark session cookies HttpOnly (script cannot read them), Secure (HTTPS only), and SameSite=Lax or Strict (limits cross-site sending). Scope with Path and avoid a wildcard Domain. These four attributes block the cheapest theft routes.
  2. Rotate the session ID on every privilege change. Issue a new identifier at login, at logout, and when a user elevates (assumes admin, re-authenticates for a sensitive action). Rotation defeats fixation and shrinks the window a captured pre-elevation token is worth anything.
  3. Expire on both idle and absolute timeouts. Enforce an inactivity timeout (for example 30 minutes) and a hard maximum lifetime (8 to 24 hours) after which re-login is required regardless of activity. A token that lives forever is a permanent key once copied.
  4. Store sessions server-side so you can revoke them. Keep a server record (a session store, Redis, a table) keyed by an opaque random ID, so logout, a password reset, or an admin action can delete it and end the session at once. If you use stateless JWTs, add a revocation list or keep lifetimes very short, because a plain JWT cannot be recalled.
  5. Generate identifiers from a CSPRNG. Use at least 128 bits from a cryptographically secure source (secrets.token_urlsafe, crypto.randomBytes), not a counter, a timestamp, or Math.random. A guessable session ID is an open door that needs no theft.
  6. Invalidate sessions on the events that demand it. On logout, delete the server record, do not just clear the cookie. On password change or reset, revoke that user's other sessions so a thief already inside is evicted.

Checks

  • Do the response headers show HttpOnly, Secure, and SameSite on the session cookie?
  • After a password reset, are the user's other active sessions rejected on their next request?
  • Does an idle session stop working after the timeout, verified by waiting past it?

Boundaries

Session management picks up after authentication succeeds and hands off to authorization for per-request access decisions. It does not cover the login flow itself (see authn-design) or token-based API patterns like OAuth bearer tokens, whose lifecycle differs. Framework session middleware handles most of this correctly; the risk is in overrides and custom stores.

Gives 0 of the 12 instructions most auth identity skills give

Counted across 409 of the 410 authors here whose files we hold, read 2026-08-06

  • hash passwords with bcrypt or argon2in 53 of 409, across 43 files
  • use parameterized queriesin 47 of 409, across 39 files
  • load SECRET_KEY from environment variablesin 23 of 409, across 14 files
  • validate all input server-sidein 19 of 409, across 11 files
  • refresh access tokens before expiryin 17 of 409, across 9 files
  • store tokens in httponly cookiesin 17 of 409, across 16 files
  • store refresh tokens securelyin 16 of 409, across 6 files
  • validate webhook signatures before processingin 15 of 409, across 5 files
  • sanitize user inputsin 15 of 409, across 9 files
  • implement rate limiting on auth endpointsin 14 of 409, across 9 files
  • encrypt sensitive data at restin 13 of 409, across 10 files
  • validate uploaded file extensions and sizesin 12 of 409, across 5 files

Said here and by no other author read

  • scope cookies with Path
  • avoid wildcard Domain
  • store sessions server-side
  • generate identifiers from a CSPRNG
  • delete server record on logout

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.