Skip to content

Chrome 146+: supportsReadBigInts() too strict — breaks cookie reading on Node 22.x #25

@navarch-orion

Description

@navarch-orion

Bug

supportsReadBigInts() in dist/util/nodeSqlite.js gates readBigInts: true behind Node >= 24.4. However, Chrome 146 (stable since March 10, 2026) stores expires_utc values in the cookies SQLite DB that exceed Number.MAX_SAFE_INTEGER (e.g. 13453521336518264).

On Node 22.x (current LTS), this causes node:sqlite to throw:

Value is too large to be represented as a JavaScript number: 13453521336518264

This breaks all Chrome cookie reading on the most common Node LTS version.

Environment

  • Node: v22.22.0 (current LTS)
  • Chrome: 146.0.7680.165 (current stable)
  • OS: macOS 15.5 (Tahoe), Apple Silicon
  • sweet-cookie: 0.1.0 (via @steipete/bird 0.8.0)

Root Cause

supportsReadBigInts() returns false for Node < 24.4:

export function supportsReadBigInts() {
    const [majorRaw, minorRaw] = process.versions.node.split('.');
    const major = Number.parseInt(majorRaw ?? '', 10);
    const minor = Number.parseInt(minorRaw ?? '', 10);
    if (major > 24) return true;
    if (major < 24) return false;
    return minor >= 4;
}

But readBigInts works fine on Node 22.x with the experimental node:sqlite module. Verified:

const { DatabaseSync } = require('node:sqlite');
const db = new DatabaseSync(':memory:', { readBigInts: true });
db.exec('CREATE TABLE t(v INTEGER)');
db.exec('INSERT INTO t VALUES (13453521336518264)');
const row = db.prepare('SELECT v FROM t').get();
console.log(typeof row.v, row.v.toString()); // bigint 13453521336518264

Fix

Change the version check to major >= 22:

export function supportsReadBigInts() {
    const [majorRaw] = process.versions.node.split('.');
    const major = Number.parseInt(majorRaw ?? '', 10);
    if (!Number.isFinite(major)) return false;
    return major >= 22;
}

This is safe because node:sqlite has been available (experimentally) since Node 22.0 and readBigInts has been supported since its introduction.

Impact

This affects anyone using sweet-cookie (or bird CLI) with:

  • Chrome >= 146 (current stable)
  • Node < 24.4 (which is everyone on LTS)

The entire Chrome cookie reading path silently fails, falling through to "no cookies found" warnings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions