Repository navigation
Preserve explicit SameSite=None in cookie headers - #639
Merged
colincasey merged 3 commits intoOct 8, 2026
Merged
Conversation
Shubham-Padkonde
requested review from
awaterma,
colincasey and
wjhsf
as code owners
September 16, 2026 05:06
|
Thanks for the contribution! Before we can merge this, we need @Shubham-Padkonde to sign the Salesforce Inc. Contributor License Agreement. |
colincasey
approved these changes
Oct 8, 2026
Contributor
|
Thanks for this PR @Shubham-Padkonde! |
colincasey
enabled auto-merge (squash)
October 8, 2026 18:46
markharding
pushed a commit
to futo-org/Harbor
that referenced
this pull request
Nov 10, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [tough-cookie](https://github.com/salesforce/tough-cookie) | [`6.0.2` → `6.1.0`](https://renovatebot.com/diffs/npm/tough-cookie/6.0.2/6.1.0) |  |  | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/2097) for more information. --- ### Release Notes <details> <summary>salesforce/tough-cookie (tough-cookie)</summary> ### [`v6.1.0`](https://github.com/salesforce/tough-cookie/releases/tag/v6.1.0) [Compare Source](salesforce/tough-cookie@v6.0.2...v6.1.0) #### Notable changes ##### `Secure` cookies are rejected when set from an insecure origin ([#​656](salesforce/tough-cookie#656), [#​663](salesforce/tough-cookie#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://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-22#section-5.7-3.13.1). `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: ```js 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](salesforce/tough-cookie#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](salesforce/tough-cookie#650)). - An explicit `SameSite=None` is now kept when serializing with `Cookie.toString()` and `getSetCookieStrings()`; it used to be dropped ([#​639](salesforce/tough-cookie#639)). - An IPv4 address in the `Domain` attribute is now accepted instead of being treated as a public suffix ([#​630](salesforce/tough-cookie#630)). ##### Additions - New exported `PrefixSecurityMode` type for the `prefixSecurity` option ([#​659](salesforce/tough-cookie#659), [#​667](salesforce/tough-cookie#667)). - The `getCookiesSync`, `getCookieString*`, `getSetCookieStrings*` and `setCookieSync` methods now accept a `URL` as well as a `string`, matching their async counterparts ([#​655](salesforce/tough-cookie#655)). #### What's Changed - Fix documentation typos by [@​Martonveghcode](https://github.com/Martonveghcode) in [#​613](salesforce/tough-cookie#613) - chore: update CODEOWNERS by [@​wjhsf](https://github.com/wjhsf) in [#​616](salesforce/tough-cookie#616) - chore(deps): bump fast-uri from 3.1.2 to 3.1.5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​623](salesforce/tough-cookie#623) - chore(deps): bump postcss from 8.5.16 to 8.5.25 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​622](salesforce/tough-cookie#622) - chore(deps): bump tldts from 7.4.5 to 7.4.10 in the production-dependencies group across 1 directory by [@​dependabot](https://github.com/dependabot)\[bot] in [#​619](salesforce/tough-cookie#619) - chore(deps-dev): bump brace-expansion from 2.1.0 to 2.1.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​629](salesforce/tough-cookie#629) - chore(deps-dev): bump the dev-dependencies group across 1 directory with 9 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​628](salesforce/tough-cookie#628) - fix: decode request path for URL object inputs, matching string inputs by [@​spokodev](https://github.com/spokodev) in [#​636](salesforce/tough-cookie#636) - chore(deps): bump [@​vitest/mocker](https://github.com/vitest/mocker) and vitest by [@​dependabot](https://github.com/dependabot)\[bot] in [#​638](salesforce/tough-cookie#638) - fix: require explicit Path attribute for \_\_Host- prefixed cookies by [@​spokodev](https://github.com/spokodev) in [#​608](salesforce/tough-cookie#608) - chore(deps-dev): bump the dev-dependencies group across 1 directory with 6 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​645](salesforce/tough-cookie#645) - chore(deps): bump js-yaml and [@​microsoft/api-documenter](https://github.com/microsoft/api-documenter) by [@​dependabot](https://github.com/dependabot)\[bot] in [#​648](salesforce/tough-cookie#648) - chore(deps-dev): bump brace-expansion from 2.1.4 to 2.1.7 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​649](salesforce/tough-cookie#649) - fix: treat an infinite max-age as never expiring in expiryTime() by [@​kwy404](https://github.com/kwy404) in [#​644](salesforce/tough-cookie#644) - chore(deps): bump tldts from 7.4.10 to 7.4.16 in the production-dependencies group across 1 directory by [@​dependabot](https://github.com/dependabot)\[bot] in [#​632](salesforce/tough-cookie#632) - chore(deps): bump fast-uri from 3.1.5 to 3.1.7 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​635](salesforce/tough-cookie#635) - chore(deps): bump source-map-js from 1.2.1 to 1.2.2 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​652](salesforce/tough-cookie#652) - Preserve explicit SameSite=None in cookie headers by [@​Shubham-Padkonde](https://github.com/Shubham-Padkonde) in [#​639](salesforce/tough-cookie#639) - docs: fix README examples and references by [@​colincasey](https://github.com/colincasey) in [#​653](salesforce/tough-cookie#653) - ci: type check test files by [@​colincasey](https://github.com/colincasey) in [#​655](salesforce/tough-cookie#655) - fix: validate cookie names against the HTTP token grammar by [@​codesbysaravana](https://github.com/codesbysaravana) in [#​650](salesforce/tough-cookie#650) - fix: accept IPv4 Domain attributes instead of treating them as public suffixes by [@​tzh476](https://github.com/tzh476) in [#​630](salesforce/tough-cookie#630) - chore(deps): bump vite from 8.2.2 to 8.3.4 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​662](salesforce/tough-cookie#662) - chore(deps): bump [@​vitest/mocker](https://github.com/vitest/mocker) and vitest by [@​dependabot](https://github.com/dependabot)\[bot] in [#​666](salesforce/tough-cookie#666) - feat: introduce PrefixSecurityMode string literal union type by [@​reginaldalfret](https://github.com/reginaldalfret) in [#​659](salesforce/tough-cookie#659) - fix(CookieJar): revert `prefixSecurity` refinement by [@​wjhsf](https://github.com/wjhsf) in [#​667](salesforce/tough-cookie#667) - fix: reject Secure cookies set over untrustworthy origins by [@​awaterma](https://github.com/awaterma) in [#​656](salesforce/tough-cookie#656) - feat: add enforceSecureOriginOnStorage option to opt out of Secure-cookie origin rejection by [@​colincasey](https://github.com/colincasey) in [#​663](salesforce/tough-cookie#663) - ci: stop patching jsdom WPT expectations in integration tests by [@​colincasey](https://github.com/colincasey) in [#​664](salesforce/tough-cookie#664) - chore(deps-dev): bump vitest from 4.1.12 to 5.0.5 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​672](salesforce/tough-cookie#672) - chore(deps): bump fast-uri from 3.1.7 to 3.1.9 by [@​dependabot](https://github.com/dependabot)\[bot] in [#​668](salesforce/tough-cookie#668) - chore(deps): bump tldts from 7.4.16 to 7.4.19 in the production-dependencies group across 1 directory by [@​dependabot](https://github.com/dependabot)\[bot] in [#​669](salesforce/tough-cookie#669) - chore(deps): bump esbuild and tsup by [@​dependabot](https://github.com/dependabot)\[bot] in [#​674](salesforce/tough-cookie#674) - chore(deps-dev): bump the dev-dependencies group across 1 directory with 9 updates by [@​dependabot](https://github.com/dependabot)\[bot] in [#​675](salesforce/tough-cookie#675) #### New Contributors - [@​Martonveghcode](https://github.com/Martonveghcode) made their first contribution in [#​613](salesforce/tough-cookie#613) - [@​spokodev](https://github.com/spokodev) made their first contribution in [#​636](salesforce/tough-cookie#636) - [@​kwy404](https://github.com/kwy404) made their first contribution in [#​644](salesforce/tough-cookie#644) - [@​Shubham-Padkonde](https://github.com/Shubham-Padkonde) made their first contribution in [#​639](salesforce/tough-cookie#639) - [@​codesbysaravana](https://github.com/codesbysaravana) made their first contribution in [#​650](salesforce/tough-cookie#650) - [@​tzh476](https://github.com/tzh476) made their first contribution in [#​630](salesforce/tough-cookie#630) - [@​reginaldalfret](https://github.com/reginaldalfret) made their first contribution in [#​659](salesforce/tough-cookie#659) **Full Changelog**: <salesforce/tough-cookie@v6.0.2...v6.1.0> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMDYuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjIwNi4yIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/2263
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #378.
Cookie.parse()already records an explicitSameSite=NoneassameSite: 'none',but
Cookie.toString()drops that attribute. As a result, parsing and serializinga Set-Cookie header loses the explicit cross-site policy;
CookieJar.getSetCookieStrings()also produces headers without it. An omitted SameSite attribute is distinct from
an explicit None value in the current cookie specification.
Include explicit None when serializing and canonicalize it to
SameSite=None,matching the existing treatment of Lax and Strict. Update the generated API
report for the additional internal canonical value.
Regression tests cover parse/serialize round trips, four constructor casing
variants, and Set-Cookie headers returned by CookieJar. Existing tests cover
omitted attributes and unknown values.
Validation
case passes.
Reference: HTTP cookie draft, SameSite semantics.
Prepared with Codex assistance for investigation, implementation and validation.