codex-proxy / src /utils /parse-cookie.ts
icebear
feat: dashboard login gate for public deployments (#148)
91ee702 unverified
raw
history blame
347 Bytes
const COOKIE_REGEX = /(?:^|;\s*)_codex_session=([^;]*)/;
/** Extract the _codex_session cookie value from a Cookie header. */
export function parseSessionCookie(cookieHeader: string | undefined): string | undefined {
if (!cookieHeader) return undefined;
const match = COOKIE_REGEX.exec(cookieHeader);
return match ? match[1] : undefined;
}