Every hop audited
Follows redirects and audits cookies set by each response, including plain http:// hops.
npm package · MIT · Node ≥ 18
Audit the cookies your site sets before attackers do.
Fetches your pages, follows every redirect, collects every Set-Cookie header from every hop and audits each cookie against modern browser rules and security best practice, with a concrete fix for every finding. Classifies cookies offline against a bundled Open Cookie Database snapshot. Also audits raw Set-Cookie lines from a file or stdin. Zero runtime dependencies.
npm i -D cookie-sentinel
$ curl -si https://app.example.com | npx cookie-sentinel --input -cookie-sentinel — 2 cookie(s) from 1 target(s) session https://app.example.com HIGH "session" has no Secure attribute; it will be sent over plain HTTP if the user ever hits an http:// URL [missing-secure] ↳ fix: Add Secure: `Set-Cookie: session=…; Secure`. HIGH "session" looks like a session/auth cookie but lacks HttpOnly, so any XSS can steal it via document.cookie [missing-httponly] ↳ fix: Add HttpOnly. MEDIUM "session" has no SameSite attribute; behaviour depends on the browser default [samesite-missing] ↳ fix: Set it explicitly: `SameSite=Lax` (or `Strict` for this session cookie). 3 high, 2 medium, 1 info✖ Failing (fail-on: high).
A session cookie without HttpOnly, a SameSite=None cookie without Secure, a Domain= that hands your auth cookie to every subdomain: these slip in through framework defaults, middleware and third-party code, and they are invisible in the UI.
cookie-sentinel collects every Set-Cookie from every redirect hop, logged-in pages included, and fails CI with the exact attribute to add.
Follows redirects and audits cookies set by each response, including plain http:// hops.
Secure, HttpOnly, SameSite, __Host- / __Secure- prefixes, Partitioned, Domain and Path scoping.
Flags JWTs in cookies, unsigned alg:none JWTs and email addresses (plain, URL-encoded, base64 or in JWT claims).
Detects duplicate cookies and one name set with different Domain/Path scopes.
Offline classification: first vs third party, tracking vs essential, vendor and category.
Headers, bearer tokens, cookie jars, scripted login and same-origin crawling.
Optional Playwright or Puppeteer peer dependency to capture cookies set by scripts.
Pipe raw Set-Cookie lines in with --input; text, JSON, SARIF and Markdown output.
# Audit a site
npx cookie-sentinel https://example.com# Extra paths, stricter gate
npx cookie-sentinel https://example.com -p /login -p /account --fail-on medium# Crawl same-origin links
npx cookie-sentinel https://app.example.com --crawl-depth 2 --max-pages 40# Offline to SARIF
npx cookie-sentinel --input set-cookies.txt --origin https://app.example.com -f sarif > cookies.sarifpermissions:
contents: read
security-events: write
jobs:
cookies:
runs-on: ubuntu-latest
steps:
- uses: MrLouisWright/cookie-sentinel@<sha>
with:
urls: https://staging.example.com
paths: /login /account
bearer: ${{ secrets.STAGING_TOKEN }}
fail-on: medium
args: --crawl-depth 1 --max-pages 20
sarif: cookies.sarif
| Flag | Description |
|---|---|
<url…> | URLs to fetch (https:// assumed). Redirects are followed and cookies from every hop are audited |
-p, --path <path> | Extra path to fetch on every URL (repeatable) |
--crawl <file> | File of URLs or paths, one per line |
--crawl-depth <n> | Follow same-origin links up to depth n (0 = off) |
--max-pages <n> | Cap when crawling (default 25) |
-H, --header "Name: value" | Request header (repeatable), e.g. Cookie or Authorization |
--headers-file <file> | JSON headers for scripted auth |
--cookies-file <file> | Cookie jar file (JSON, name=value lines, or Netscape format) |
--bearer <token> | Authorization: Bearer shortcut (or COOKIE_SENTINEL_BEARER) |
--browser <engine> | playwright or puppeteer (optional peer dependencies) |
-i, --input <file|-> | Audit raw Set-Cookie lines offline |
--origin <url> | URL context for --input (default https://example.com/) |
-c, --config <file> | JSON config (default .cookie-sentinel.json if present) |
-f, --format | text (default), json, sarif, markdown |
--fail-on <sev> | critical, high (default), medium, low, info or none |
--no-classify | Skip Open Cookie Database enrichment |
Full reference, config file format and API in the README.
Support this project
I build free, open-source tools that help developers ship safer websites. Every coffee helps keep them maintained, documented and free for everyone.
Buy me a coffee (opens Stripe in a new tab)Secure checkout by Stripe