tough-cookie
6.1.0 · 6 Nov 2026BSD-3-Clause202.3M / weekRepositorynpmAtom feed
51 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 6.x · latest line
6.1.0
6 Nov 2026Summary· from the note as AI read it
Read before upgrading: 8 changes to make.
Notable changes
Securecookies are rejected when set from an insecure origin (#656, #663)CookieJarnow refuses to store aSecurecookie set from a URL that isn't potentially trustworthy, such as plainhttp://example.com, per RFC 6265bis §5.7 step 13.https:andwss:URLs are still accepted, and so arelocalhostand loopback addresses whileallowSecureOnLocalis enabled (the default).setCookie()now rejects withCookie is Secure but this is not a secure connection, or drops the cookie silently whenignoreError: trueis passed.This changes behavior that existing v6 code may rely on. To keep storing
Securecookies no matter which origin set them, opt out with:new CookieJar(store, { enforceSecureOriginOnStorage: false })The opt-out applies only to storage. On retrieval,
Securecookies are still returned only for secure origins, the same as in v6.0.x. The setting survivesserialize()/deserialize()andclone().Other behavior changes
__Host-cookies now need an explicitPath=/attribute. Having the default path come out as/is no longer enough (#608).Cookie.validate()now returnsfalsefor 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=Noneis now kept when serializing withCookie.toString()andgetSetCookieStrings(); it used to be dropped (#639).An IPv4 address in the
Domainattribute is now accepted instead of being treated as a public suffix (#630).
Additions
6.0.2
7 Jul 2026Review Section 5.1.3. Domain Matching
Avoid decoding URL authority part
Dependency bumps in too many PRs to bother enumerating
6.0.1
12 Mar 2026Review Section 5.1.1. Dates
Adopt npm trusted publishing (OIDC)
6.0.0
14 Aug 2025- Breaking
Localhost connections over
httpwill now be considered secure by default. For more information, see the README documentation and API Docs for how to configure this feature. Dual publishing of ESM+CJS
Bump the dev-dependencies group with 10 updates
Summary
Breaking Changes
- Breaking
Localhost connections over
httpwill 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 the dev-dependencies group with 10 updates
Bump tldts from 6.1.76 to 6.1.79 in the production-dependencies group
Bump tldts from 6.1.83 to 6.1.85 in the production-dependencies group
Bump the dev-dependencies group with 9 updates
Add RFC 6761–compliant localhost loopback checks so secure cookies work on localhost (fixes: #382)
Use ESM instead of CJS
Switch from jest to vitest
Bump the dev-dependencies group with 9 updates
Prepare release v6.0.0-rc.0
Bump the dev-dependencies group with 12 updates
Bump tldts from 7.0.5 to 7.0.8 in the production-dependencies group
Create CONTRIBUTING.md
Bump tldts from 7.0.8 to 7.0.9 in the production-dependencies group
Bump the dev-dependencies group with 12 updates
Reverts the check on the Secure attribute when setting a cookie
Prepare release v6.0.0-rc.1
Bump the dev-dependencies group with 8 updates
Support publishing of both ESM and CJS
Prepare v6
- 5.x
5.1.2
28 Feb 2025Fix regression bug in
domainMatch
5.1.1
7 Feb 2025Bump the dev-dependencies group with 7 updates
Isolated modules and almost isolated declarations
What's Changed
Bump the dev-dependencies group with 7 updates
Bump tldts from 6.1.71 to 6.1.76 in the production-dependencies group
Isolated modules and almost isolated declarations
5.1.0
9 Jan 2025Update README.md
Remove cookies that expire at epoch time of
0Restore missing
expiryDatemethod
What's Changed
Update README.md
Remove cookies that expire at epoch time of
0Restore missing
expiryDatemethodBump tldts from 6.1.41 to 6.1.48 in the production-dependencies group
Bump the dev-dependencies group with 7 updates
path-match: Avoid parsing path as regex
Bump tldts from 6.1.48 to 6.1.57 in the production-dependencies group
Bump the dev-dependencies group with 8 updates
Bump tldts from 6.1.57 to 6.1.65 in the production-dependencies group
Bump the dev-dependencies group across 1 directory with 8 updates
Bump the dev-dependencies group across 1 directory with 8 updates
Bump tldts from 6.1.65 to 6.1.71 in the production-dependencies group across 1 directory
Fix npm token config for publish
Give permissions for provenance generation
Use runtime-agnostic
domainToASCIIPrepare release v5.1.0
5.0.0
9 Sep 2024- Breaking
We've migrated the project to TypeScript! First-party types are now available.
- Breaking
The minimum supported version of node is v18.
- Breaking
We no longer provide official support for non-node enviroments.
Summary
Breaking Changes
- Breaking
We've migrated the project to TypeScript! First-party types are now available.
- Breaking
The minimum supported version of node is v18.
- Breaking
We no longer provide official support for non-node enviroments.
API Changes
We've standardized most of our exposed interfaces to accept both
nullandundefinedand return onlyundefined.getCookieandgetCookiesnow accept astringorURLas a parameter.We've removed the
inspectfunction in favor of node'sutil.inspect.customsymbol. 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.
- 4.x
4.1.4
29 Apr 2024Add local alias for
toStringFix incorrect string validation for URL
npmjs.com/package/tough-cookie/v/4.1.4
What's Changed
Add local alias for
toStringFix incorrect string validation for URL
4.1.2
25 Aug 2022Allow set cookies with localhost
4.1.1
24 Aug 2022Allow special use domains by default
4.1.1 Patch -- allow special use domains by default
4.1.0
22 Aug 2022Create CHANGELOG.md
Missing param validation issue145
Create SECURITY.md
v4.1.0
Minor release, focused mainly on resolving reported issues and some minor feature work.
What's Changed
Create CHANGELOG.md
Missing param validation issue145
Create SECURITY.md
Create CODE_OF_CONDUCT.md
Fix for issue #195
Add explanation and more special-use domains
Sync of constructor options for serialization
Returned null in case of empty cookie value
132 str trim not a function
Fix for issue #153
Fix permuteDomain with trailing dot
Issue #213 -- added gh-actions flow for building and testing tough-co…
Issue #210 -- Updated workflow to use npm install.
@GH-215 -- Tests that document localhost behavior when set as domain.
MemoryCookieStore methods should exist on the prototype, not on the class.
React Native Support
Adding Updating CODEOWNERS with ECCN as per Export Control Compliance
Domain match routine
Stop using the internal NodeJS punycode module
Initial documentation review
Distinguish between no samesite and samesite=none
Prepare tough-cookie 4.1 for publishing (updated GitHub actions, move…
4.1.0 release to NPM
4.0.0
19 Mar 2020- Breaking
Modernized JS Syntax
- Breaking
Upgraded version dependencies for
pslandasync - Breaking
Re-order parameters for
findCookies()- callback fn has to be last in order to comply withuniversalify
Breaking Changes (Major Version)
- Breaking
Modernized JS Syntax
Use ESLint and Prettier to apply consistent, modern formatting (add dependency on
universalify,eslintandprettier)
- Breaking
Upgraded version dependencies for
pslandasync - Breaking
Re-order parameters for
findCookies()- callback fn has to be last in order to comply withuniversalify - Breaking
Use Classes instead of function prototypes to define classes
Might break people using
.call()to do inheritance using function prototypes
Minor Changes
SameSite cookie support
Cookie prefix support
Support for promises
'.local' support
Numerous bug fixes!
- 3.x
- 2.x
2.0.0 – 2.5.013 releases without a noteShow each
- 1.x
- 0.13.x
0.13.0
22 Apr 2015- 0.12.x
- 0.11.x
0.11.0
13 Jan 2014- 0.10.x
0.10.0
10 Jan 2014- 0.9.x
0.9.1 – 0.9.1513 releases without a noteShow each
- 0.9.1525 Jan 2013no note
- 0.9.1428 Sep 2012no note
- 0.9.138 May 2012no note
- 0.9.1225 Apr 2012no note
- 0.9.1123 Apr 2012no note
- 0.9.917 Apr 2012no note
- 0.9.815 Dec 2011no note
- 0.9.71 Dec 2011no note
- 0.9.623 Nov 2011no note
- 0.9.523 Nov 2011no note
- 0.9.423 Nov 2011no note
- 0.9.37 Nov 2011no note
- 0.9.131 Oct 2011no note
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.