Set-Cookie Check

Reads back what the browser will really do with each Set-Cookie and flags attributes that get it rejected or exposed.

StopsLogin cookie silently rejected

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/set-cookie-check.json

The files land in your project. They're yours to edit.

Usage

set-cookie-check-usage.tsx
import { SetCookieCheck } from "@/components/ui/set-cookie-check"

return <SetCookieCheck host="app.acme.com" defaultValue={fromTheLoginRoute} now={Date.UTC(2026, 9, 14)} />

What it catches

  • SameSite=None or Partitioned without Secure
  • __Host- and __Secure- prefix rule violations
  • A Domain that shares a session cookie with every subdomain
  • Missing HttpOnly on session-like cookies
  • Expires and Max-Age that disagree, and lifetimes past the 400-day cap
  • Name plus value over 4096 bytes

Props

SetCookieCheck props
PropTypeDefault
value

Controlled text: one Set-Cookie per line, with or without the "Set-Cookie:" prefix.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the new text on every edit or fix.

(value: string) => void—
host

Host that sends the header, e.g. "app.acme.com". Enables Domain checks.

string—
https

The response is served over https (default true).

booleantrue
now

Clock in ms for Expires and the 400-day cap. Defaults to the time the component mounted.

number—
sessionPattern

Cookie names treated as sign-in sessions.

RegExp—
locale

Locale for dates in the readback (default "en-US", always in UTC).

string"en-US"
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{name}`, `{host}`, `{domain}`, `{duration}`, `{date}`, `{detail}`, `{from}`, `{to}`, `{count}`, `{requested}` are filled in.

Partial<SetCookieCheckMessages>—

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible <label> on the textarea; aria-invalid and a role=status issue count
  • Each cookie is a section with an aria-label
  • Fix buttons have aria-labels naming the action and cookie; focus moves to the next fix after one is applied

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

This is a UX guard rail. Enforce on the server: Set cookie attributes in server code and test them in real browsers; this only lints the header text.

  • Follows RFC 6265bis (a draft) and CHIPS; individual browsers may differ
  • Checks header text, not what your server actually sends
  • Session-cookie detection uses a name pattern (sessionPattern)

Rules

Rules last verified:

Confirmed in the editor's draft: lifetime limit SHOULD NOT exceed 400 days, name+value over 4096 octets is ignored, and the __Host-/__Secure- prefix requirements. CHIPS (Partitioned) not re-checked. It is a draft; check for changes. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What it stops

Login cookie silently rejected

Also known as

set-cookie · cookies · samesite · httponly · secure · auth cookie · session cookie · cors

Field type

Dependencies

Pairs well with