Skip to content

Commit 62be1e4

Browse files
authored
Prepare v6 (#538)
* Update README.md with changes related to potentially trustworthy origins * 6.0.0 * Fix README link
1 parent 5e2cf1c commit 62be1e4

File tree

6 files changed

+47
-6
lines changed

6 files changed

+47
-6
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,44 @@ await cookieJar.setCookie(
134134
> [!NOTE]
135135
> It is highly recommended that you read [RFC6265bis - Section 4.1.3][cookie-prefixes-implementation] for more details on Cookie Prefixes.
136136
137+
### Potentially Trustworthy Origins are considered "Secure"
138+
139+
The definition of a "Secure" connection is not explicitly defined by [RFC6265bis][rfc6265bis-tracker] but the following text is
140+
provided in [RFC6265bis - Section 5.8.3][secure-connection-note]:
141+
142+
> [!NOTE]
143+
> Typically, user agents consider a connection secure if the connection makes use of transport-layer security, such as
144+
> SSL or TLS, or if the host is trusted. For example, most user agents consider "https" to be a scheme that denotes a
145+
> secure protocol and "localhost" to be trusted host.
146+
147+
As well as a note to [Appendix A. Changes from RFC6265][secure-connection-appendix-a] which refers to **"potentially trustworthy
148+
origins"** which are defined in the [Secure Contexts - W3C Candidate Recommendation Draft][potentially-trustworthy-origin]:
149+
150+
> [!Note]
151+
> Considers potentially trustworthy origins as "secure".
152+
153+
Since most web browsers treat `localhost` as a trustworthy origin, by default, so does `tough-cookie`. To disable this
154+
behavior, the `CookieStore` must be configured with:
155+
156+
```typescript
157+
import { CookieJar, MemoryCookieStore } from 'tough-cookie'
158+
159+
const cookieJar = new CookieJar(new MemoryCookieStore(), {
160+
// add configuration so localhost will not be considered trustworthy
161+
// (fyi - this doesn't apply to https cookies on localhost as those use a secure protocol)
162+
allowSecureOnLocal: false,
163+
})
164+
165+
// this cookie will be persisted to storage
166+
await cookieJar.setCookie(
167+
'SID=12345; Domain=localhost; Secure;',
168+
'http://localhost',
169+
)
170+
171+
// but, on retrieval, it will not be returned
172+
await cookieJar.getCookiesSync('http://localhost')
173+
```
174+
137175
## Node.js Version Support
138176

139177
We follow the [Node.js release schedule](https://github.com/nodejs/Release#release-schedule) and support
@@ -150,5 +188,8 @@ for older versions of node, and we will do so in consultation with our community
150188
[rfc6265bis-tracker]: https://datatracker.ietf.org/doc/draft-ietf-httpbis-rfc6265bis/
151189
[samesite-implementation]: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-02#section-8.8
152190
[cookie-prefixes-implementation]: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-02#section-4.1.3
191+
[secure-connection-note]: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-19#section-5.8.3-2.1.2.3.1
192+
[secure-connection-appendix-a]: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis-19#appendix-A-1.7.1
193+
[potentially-trustworthy-origin]: https://www.w3.org/TR/secure-contexts/#is-origin-trustworthy
153194
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
154195
[yarn-repo]: https://yarnpkg.com/package?name=tough-cookie

api/docs/tough-cookie.version.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ The version of `tough-cookie`
99
**Signature:**
1010

1111
```typescript
12-
version = "6.0.0-rc.2"
12+
version = "6.0.0"
1313
```

api/tough-cookie.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export class Store {
300300
}
301301

302302
// @public
303-
export const version = "6.0.0-rc.2";
303+
export const version = "6.0.0";
304304

305305
// (No @packageDocumentation comment for this package)
306306

lib/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
* The version of `tough-cookie`
33
* @public
44
*/
5-
export const version = '6.0.0-rc.2'
5+
export const version = '6.0.0'

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"RFC6265",
7676
"RFC2965"
7777
],
78-
"version": "6.0.0-rc.2",
78+
"version": "6.0.0",
7979
"homepage": "https://github.com/salesforce/tough-cookie",
8080
"repository": {
8181
"type": "git",

0 commit comments

Comments
 (0)