Skip to content

Releases

v6.1.0

Choose a tag to compare

@colincasey colincasey released this 06 Nov 17:24
v6.1.0
f5dd871

Notable changes

Secure cookies are rejected when set from an insecure origin (#656, #663)

CookieJar now refuses to store a Secure cookie set from a URL that isn't potentially trustworthy, such as plain http://example.com, per RFC 6265bis Β§5.7 step 13. https: and wss: URLs are still accepted, and so are localhost and loopback addresses while allowSecureOnLocal is enabled (the default). setCookie() now rejects with Cookie is Secure but this is not a secure connection, or drops the cookie silently when ignoreError: true is passed.

This changes behavior that existing v6 code may rely on. To keep storing Secure cookies no matter which origin set them, opt out with:

new CookieJar(store, { enforceSecureOriginOnStorage: false })

The opt-out applies only to storage. On retrieval, Secure cookies are still returned only for secure origins, the same as in v6.0.x. The setting survives serialize()/deserialize() and clone().

Other behavior changes

  • __Host- cookies now need an explicit Path=/ attribute. Having the default path come out as / is no longer enough (#608).
  • Cookie.validate() now returns false for names that aren't valid HTTP tokens, such as empty names, names with separators or control characters, and non-ASCII names. Parsing and storage are unchanged (#650).
  • An explicit SameSite=None is now kept when serializing with Cookie.toString() and getSetCookieStrings(); it used to be dropped (#639).
  • An IPv4 address in the Domain attribute is now accepted instead of being treated as a public suffix (#630).

Additions

  • New exported PrefixSecurityMode type for the prefixSecurity option (#659, #667).
  • The getCookiesSync, getCookieString*, getSetCookieStrings* and setCookieSync methods now accept a URL as well as a string, matching their async counterparts (#655).

What's Changed

  • Fix documentation typos by @Martonveghcode in #613
  • chore: update CODEOWNERS by @wjhsf in #616
  • chore(deps): bump fast-uri from 3.1.2 to 3.1.5 by @dependabot[bot] in #623
  • chore(deps): bump postcss from 8.5.16 to 8.5.25 by @dependabot[bot] in #622
  • chore(deps): bump tldts from 7.4.5 to 7.4.10 in the production-dependencies group across 1 directory by @dependabot[bot] in #619
  • chore(deps-dev): bump brace-expansion from 2.1.0 to 2.1.4 by @dependabot[bot] in #629
  • chore(deps-dev): bump the dev-dependencies group across 1 directory with 9 updates by @dependabot[bot] in #628
  • fix: decode request path for URL object inputs, matching string inputs by @spokodev in #636
  • chore(deps): bump @vitest/mocker and vitest by @dependabot[bot] in #638
  • fix: require explicit Path attribute for __Host- prefixed cookies by @spokodev in #608
  • chore(deps-dev): bump the dev-dependencies group across 1 directory with 6 updates by @dependabot[bot] in #645
  • chore(deps): bump js-yaml and @microsoft/api-documenter by @dependabot[bot] in #648
  • chore(deps-dev): bump brace-expansion from 2.1.4 to 2.1.7 by @dependabot[bot] in #649
  • fix: treat an infinite max-age as never expiring in expiryTime() by @kwy404 in #644
  • chore(deps): bump tldts from 7.4.10 to 7.4.16 in the production-dependencies group across 1 directory by @dependabot[bot] in #632
  • chore(deps): bump fast-uri from 3.1.5 to 3.1.7 by @dependabot[bot] in #635
  • chore(deps): bump source-map-js from 1.2.1 to 1.2.2 by @dependabot[bot] in #652
  • Preserve explicit SameSite=None in cookie headers by @Shubham-Padkonde in #639
  • docs: fix README examples and references by @colincasey in #653
  • ci: type check test files by @colincasey in #655
  • fix: validate cookie names against the HTTP token grammar by @codesbysaravana in #650
  • fix: accept IPv4 Domain attributes instead of treating them as public suffixes by @tzh476 in #630
  • chore(deps): bump vite from 8.2.2 to 8.3.4 by @dependabot[bot] in #662
  • chore(deps): bump @vitest/mocker and vitest by @dependabot[bot] in #666
  • feat: introduce PrefixSecurityMode string literal union type by @reginaldalfret in #659
  • fix(CookieJar): revert prefixSecurity refinement by @wjhsf in #667
  • fix: reject Secure cookies set over untrustworthy origins by @awaterma in #656
  • feat: add enforceSecureOriginOnStorage option to opt out of Secure-cookie origin rejection by @colincasey in #663
  • ci: stop patching jsdom WPT expectations in integration tests by @colincasey in #664
  • chore(deps-dev): bump vitest from 4.1.12 to 5.0.5 by @dependabot[bot] in #672
  • chore(deps): bump fast-uri from 3.1.7 to 3.1.9 by @dependabot[bot] in #668
  • chore(deps): bump tldts from 7.4.16 to 7.4.19 in the production-dependencies group across 1 directory by @dependabot[bot] in #669
  • chore(deps): bump esbuild and tsup by @dependabot[bot] in #674
  • chore(deps-dev): bump the dev-dependencies group across 1 directory with 9 updates by @dependabot[bot] in #675

New Contributors

Full Changelog: v6.0.2...v6.1.0

v6.0.2

Choose a tag to compare

@wjhsf wjhsf released this 07 Jul 18:31
v6.0.2
40708dd

What's Changed

  • Review Section 5.1.3. Domain Matching by @colincasey in #580
  • fix: avoid decoding URL authority part by @wjhsf in #614
  • dependency bumps in too many PRs to bother enumerating

Full Changelog: v6.0.1...v6.0.2

v6.0.1

Choose a tag to compare

@colincasey colincasey released this 12 Mar 18:38
3a4fae6

Notable

What's Changed

  • Bump the dev-dependencies group across 1 directory with 9 updates by @dependabot[bot] in #543
  • Bump tldts from 7.0.10 to 7.0.12 in the production-dependencies group by @dependabot[bot] in #540
  • Bump the dev-dependencies group with 8 updates by @dependabot[bot] in #545
  • Bump tldts from 7.0.16 to 7.0.17 in the production-dependencies group by @dependabot[bot] in #544
  • Bump vitest from 3.2.4 to 4.0.6 by @dependabot[bot] in #546
  • Bump js-yaml from 4.1.0 to 4.1.1 by @dependabot[bot] in #548
  • Bump glob from 10.4.5 to 10.5.0 by @dependabot[bot] in #549
  • Bump tldts from 7.0.17 to 7.0.19 in the production-dependencies group by @dependabot[bot] in #550
  • test(timing): retry flaky test and increase threshold by @wjhsf in #552
  • Bump the dev-dependencies group with 8 updates by @dependabot[bot] in #551
  • chore(deps): bump lodash from 4.17.21 to 4.17.23 by @dependabot[bot] in #555
  • chore(deps): bump tldts from 7.0.19 to 7.0.21 in the production-dependencies group by @dependabot[bot] in #556
  • chore(deps-dev): bump the dev-dependencies group across 1 directory with 10 updates by @dependabot[bot] in #557
  • chore(deps): bump rollup from 4.44.2 to 4.59.0 by @dependabot[bot] in #558
  • chore(deps): bump tldts from 7.0.21 to 7.0.23 in the production-dependencies group by @dependabot[bot] in #559
  • Review Section 5.1.1. Dates by @colincasey in #547
  • chore(deps-dev): bump the dev-dependencies group with 5 updates by @dependabot[bot] in #560
  • Fix api-documenter CRLF line endings in generated docs by @colincasey in #570
  • Adopt npm trusted publishing (OIDC) by @colincasey in #571
  • chore: group eslint deps in dependabot config by @colincasey in #563
  • chore(deps): bump tldts from 7.0.23 to 7.0.25 in the production-dependencies group by @dependabot[bot] in #573
  • Prepare release v6.0.1 by @colincasey in #572

Full Changelog: v6.0.0...v6.0.1

v6.0.0

Choose a tag to compare

@colincasey colincasey released this 14 Aug 19:55
62be1e4

Summary

Breaking Changes

  • Localhost connections over http will now be considered secure by default. For more information, see the README documentation and API Docs for how to configure this feature.

Other Notable Changes

  • Dual publishing of ESM+CJS

What's Changed

  • Bump globals from 15.14.0 to 16.0.0 by @dependabot[bot] in #504
  • Bump the dev-dependencies group with 10 updates by @dependabot[bot] in #503
  • Bump tldts from 6.1.76 to 6.1.79 in the production-dependencies group by @dependabot[bot] in #502
  • Bump tldts from 6.1.83 to 6.1.85 in the production-dependencies group by @dependabot[bot] in #507
  • Bump the dev-dependencies group with 9 updates by @dependabot[bot] in #508
  • Bump eslint-import-resolver-typescript from 3.8.3 to 4.3.1 by @dependabot[bot] in #509
  • feat: Add RFC 6761–compliant localhost loopback checks so secure cookies work on localhost (fixes: #382) by @Chriss4123 in #498
  • use ESM instead of CJS by @wjhsf in #506
  • Switch from jest to vitest by @wjhsf in #510
  • Bump vite from 6.2.6 to 6.3.4 by @dependabot[bot] in #521
  • Bump the dev-dependencies group with 9 updates by @dependabot[bot] in #522
  • Bump tldts from 6.1.85 to 7.0.5 by @dependabot[bot] in #523
  • Prepare release v6.0.0-rc.0 by @colincasey in #519
  • Bump the dev-dependencies group with 12 updates by @dependabot[bot] in #525
  • Bump tldts from 7.0.5 to 7.0.8 in the production-dependencies group by @dependabot[bot] in #524
  • Create CONTRIBUTING.md by @wjhsf in #526
  • Bump tldts from 7.0.8 to 7.0.9 in the production-dependencies group by @dependabot[bot] in #530
  • chore(deps): bump tldts from 7.0.9 to 7.0.10 in the production-dependencies group by @dependabot[bot] in #532
  • Bump the dev-dependencies group with 12 updates by @dependabot[bot] in #531
  • Reverts the check on the Secure attribute when setting a cookie by @colincasey in #534
  • Prepare release v6.0.0-rc.1 by @colincasey in #535
  • Bump the dev-dependencies group with 8 updates by @dependabot[bot] in #537
  • Support publishing of both ESM and CJS by @colincasey in #536
  • Prepare v6 by @colincasey in #538

New Contributors

Full Changelog: v5.1.2...v6.0.0

v5.1.2

Choose a tag to compare

@colincasey colincasey released this 28 Feb 18:26
a2c72ef

What's Changed

Full Changelog: v5.1.1...v5.1.2

v5.1.1

Choose a tag to compare

@wjhsf wjhsf released this 07 Feb 17:31
2899336

What's Changed

  • chore: avoid nodejs modules by @wjhsf in #487
  • Bump the dev-dependencies group with 7 updates by @dependabot in #490
  • Bump tldts from 6.1.71 to 6.1.76 in the production-dependencies group by @dependabot in #489
  • Bump eslint-config-prettier from 9.1.0 to 10.0.1 by @dependabot in #491
  • isolated modules and almost isolated declarations by @wjhsf in #486
  • chore: auto-close spam PRs by @wjhsf in #493

Full Changelog: v5.1.0...v5.1.1

v5.1.0

Choose a tag to compare

@colincasey colincasey released this 09 Jan 15:36
f27648d

What's Changed

  • Scheduled integration test with jsdom by @colincasey in #450
  • Update README.md by @colincasey in #454
  • fix: remove cookies that expire at epoch time of 0 by @colincasey in #457
  • Restore missing expiryDate method by @colincasey in #459
  • Bump tldts from 6.1.41 to 6.1.48 in the production-dependencies group by @dependabot in #461
  • Bump the dev-dependencies group with 7 updates by @dependabot in #462
  • fix(path-match): avoid parsing path as regex by @wjhsf in #465
  • Bump tldts from 6.1.48 to 6.1.57 in the production-dependencies group by @dependabot in #466
  • Bump the dev-dependencies group with 8 updates by @dependabot in #467
  • Bump tldts from 6.1.57 to 6.1.65 in the production-dependencies group by @dependabot in #468
  • Bump the dev-dependencies group across 1 directory with 8 updates by @dependabot in #471
  • chore: streamline package publishing by @wjhsf in #453
  • Bump the dev-dependencies group across 1 directory with 8 updates by @dependabot in #476
  • Bump tldts from 6.1.65 to 6.1.71 in the production-dependencies group across 1 directory by @dependabot in #478
  • Fix npm token config for publish by @colincasey in #482
  • Give permissions for provenance generation by @colincasey in #483
  • revert: use runtime-agnostic domainToASCII by @wjhsf in #480
  • Prepare release v5.1.0 by @colincasey in #484

Full Changelog: v5.0.0...v5.1.0

v5.1.0-rc.0

v5.1.0-rc.0 Pre-release
Pre-release

Choose a tag to compare

@colincasey colincasey released this 08 Jan 18:56
b407f60

What's Changed

  • Scheduled integration test with jsdom by @colincasey in #450
  • Update README.md by @colincasey in #454
  • fix: remove cookies that expire at epoch time of 0 by @colincasey in #457
  • Restore missing expiryDate method by @colincasey in #459
  • Bump tldts from 6.1.41 to 6.1.48 in the production-dependencies group by @dependabot in #461
  • Bump the dev-dependencies group with 7 updates by @dependabot in #462
  • fix(path-match): avoid parsing path as regex by @wjhsf in #465
  • Bump tldts from 6.1.48 to 6.1.57 in the production-dependencies group by @dependabot in #466
  • Bump the dev-dependencies group with 8 updates by @dependabot in #467
  • Bump tldts from 6.1.57 to 6.1.65 in the production-dependencies group by @dependabot in #468
  • Bump the dev-dependencies group across 1 directory with 8 updates by @dependabot in #471
  • chore: streamline package publishing by @wjhsf in #453
  • Bump the dev-dependencies group across 1 directory with 8 updates by @dependabot in #476
  • Bump tldts from 6.1.65 to 6.1.71 in the production-dependencies group across 1 directory by @dependabot in #478
  • Fix npm token config for publish by @colincasey in #482
  • Give permissions for provenance generation by @colincasey in #483

Full Changelog: v5.0.0...v5.1.0-rc.0

v5.0.0

Choose a tag to compare

@awaterma awaterma released this 09 Sep 16:39
7ed1b8a

Summary

Breaking Changes

  • We've migrated the project to TypeScript! First-party types are now available.
  • The minimum supported version of node is v18.
  • We no longer provide official support for non-node enviroments.

API Changes

  • We've standardized most of our exposed interfaces to accept both null and undefined and return only undefined.
  • getCookie and getCookies now accept a string or URL as a parameter.
  • We've removed the inspect function in favor of node's util.inspect.custom symbol. Cookies may appear different when logged in non-node environments.

Other Changes

  • Fixed the expiry time not updating when a cookie is updating.
  • Fixed validation errors not getting called in some callbacks.
  • New documentation that is always kept up to date!
  • Performance improvements.

What's Changed

New Contributors

  • ...
Read more

v4.1.4

Choose a tag to compare

@colincasey colincasey released this 29 Apr 14:12

https://www.npmjs.com/package/tough-cookie/v/4.1.4

What's Changed

New Contributors

Full Changelog: v4.1.3...v4.1.4