@plotdb/express-session 1.17.4 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,6 +58,26 @@ For a list of stores, see [compatible session stores](#compatible-session-stores
58
58
  Settings object for the session ID cookie. The default value is
59
59
  `{ path: '/', httpOnly: true, secure: false, maxAge: null }`.
60
60
 
61
+ In addition to providing a static object, you can also pass a callback function to dynamically generate the cookie options for each request. The callback receives the `req` object as its argument and should return an object containing the cookie settings.
62
+
63
+ ```js
64
+ var app = express()
65
+ app.use(session({
66
+ secret: 'keyboard cat',
67
+ resave: false,
68
+ saveUninitialized: true,
69
+ cookie: function(req) {
70
+ var match = req.url.match(/^\/([^/]+)/);
71
+ return {
72
+ path: match ? '/' + match[1] : '/',
73
+ httpOnly: true,
74
+ secure: req.secure || false,
75
+ maxAge: 60000
76
+ }
77
+ }
78
+ }))
79
+ ```
80
+
61
81
  The following are options that can be set in this object.
62
82
 
63
83
  ##### cookie.domain
@@ -98,11 +118,43 @@ no maximum age is set.
98
118
  **Note** If both `expires` and `maxAge` are set in the options, then the last one
99
119
  defined in the object is what is used.
100
120
 
121
+ ##### cookie.partitioned
122
+
123
+ Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`][rfc-cutler-httpbis-partitioned-cookies]
124
+ attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not.
125
+ By default, the `Partitioned` attribute is not set.
126
+
127
+ **Note** This is an attribute that has not yet been fully standardized, and may
128
+ change in the future. This also means many clients may ignore this attribute until
129
+ they understand it.
130
+
131
+ More information about can be found in [the proposal](https://github.com/privacycg/CHIPS).
132
+
101
133
  ##### cookie.path
102
134
 
103
135
  Specifies the value for the `Path` `Set-Cookie`. By default, this is set to `'/'`, which
104
136
  is the root path of the domain.
105
137
 
138
+ Since 1.19.1, path matching follows [RFC 6265 section 5.1.4][rfc-6265-5.1.4]. This means
139
+ the session middleware will only activate when the request path is an exact match or falls
140
+ under a segment boundary of the cookie path. For example, a cookie path of `/admin` will
141
+ match `/admin` and `/admin/users` but will **not** match `/administrator`. Prior versions
142
+ used a simple prefix check that did not enforce segment boundaries.
143
+
144
+ ##### cookie.priority
145
+
146
+ Specifies the `string` to be the value for the [`Priority` `Set-Cookie` attribute][rfc-west-cookie-priority-00-4.1].
147
+
148
+ - `'low'` will set the `Priority` attribute to `Low`.
149
+ - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
150
+ - `'high'` will set the `Priority` attribute to `High`.
151
+
152
+ More information about the different priority levels can be found in
153
+ [the specification][rfc-west-cookie-priority-00-4.1].
154
+
155
+ **Note** This is an attribute that has not yet been fully standardized, and may change in the future.
156
+ This also means many clients may ignore this attribute until they understand it.
157
+
106
158
  ##### cookie.sameSite
107
159
 
108
160
  Specifies the `boolean` or `string` to be the value for the `SameSite` `Set-Cookie` attribute.
@@ -113,6 +165,7 @@ By default, this is `false`.
113
165
  - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
114
166
  - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
115
167
  - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
168
+ - `'auto'` will set the `SameSite` attribute to `None` for secure connections and `Lax` for non-secure connections.
116
169
 
117
170
  More information about the different enforcement levels can be found in
118
171
  [the specification][rfc-6265bis-03-4.1.2.7].
@@ -124,6 +177,14 @@ the future. This also means many clients may ignore this attribute until they un
124
177
  that requires that the `Secure` attribute be set to `true` when the `SameSite` attribute has been
125
178
  set to `'none'`. Some web browsers or other clients may be adopting this specification.
126
179
 
180
+ The `cookie.sameSite` option can also be set to the special value `'auto'` to have
181
+ this setting automatically match the determined security of the connection. When the connection
182
+ is secure (HTTPS), the `SameSite` attribute will be set to `None` to enable cross-site usage.
183
+ When the connection is not secure (HTTP), the `SameSite` attribute will be set to `Lax` for
184
+ better security while maintaining functionality. This is useful when the Express `"trust proxy"`
185
+ setting is properly setup to simplify development vs production configuration, particularly
186
+ for SAML authentication scenarios.
187
+
127
188
  ##### cookie.secure
128
189
 
129
190
  Specifies the `boolean` value for the `Secure` `Set-Cookie` attribute. When truthy,
@@ -252,7 +313,7 @@ With this enabled, the session identifier cookie will expire in
252
313
  [`maxAge`](#cookiemaxage) since the last response was sent instead of in
253
314
  [`maxAge`](#cookiemaxage) since the session was last modified by the server.
254
315
 
255
- This is typically used in conjuction with short, non-session-length
316
+ This is typically used in conjunction with short, non-session-length
256
317
  [`maxAge`](#cookiemaxage) values to provide a quick timeout of the session data
257
318
  with reduced potential of it occurring during on going server interactions.
258
319
 
@@ -283,12 +344,13 @@ it to be saved. *This has been fixed in PassportJS 0.3.0*
283
344
 
284
345
  **Required option**
285
346
 
286
- This is the secret used to sign the session ID cookie. This can be either a string
287
- for a single secret, or an array of multiple secrets. If an array of secrets is
288
- provided, only the first element will be used to sign the session ID cookie, while
289
- all the elements will be considered when verifying the signature in requests. The
290
- secret itself should be not easily parsed by a human and would best be a random set
291
- of characters. A best practice may include:
347
+ This is the secret used to sign the session ID cookie. The secret can be any type
348
+ of value that is supported by Node.js `crypto.createHmac` (like a string or a
349
+ `Buffer`). This can be either a single secret, or an array of multiple secrets. If
350
+ an array of secrets is provided, only the first element will be used to sign the
351
+ session ID cookie, while all the elements will be considered when verifying the
352
+ signature in requests. The secret itself should be not easily parsed by a human and
353
+ would best be a random set of characters. A best practice may include:
292
354
 
293
355
  - The use of environment variables to store the secret, ensuring the secret itself
294
356
  does not exist in your repository.
@@ -303,6 +365,9 @@ the secret without invalidating sessions, provide an array of secrets, with the
303
365
  secret as first element of the array, and including previous secrets as the later
304
366
  elements.
305
367
 
368
+ **Note** HMAC-256 is used to sign the session ID. For this reason, the secret should
369
+ contain at least 32 bytes of entropy.
370
+
306
371
  ##### store
307
372
 
308
373
  The session store instance, defaults to a new `MemoryStore` instance.
@@ -565,6 +630,11 @@ and other multi-core embedded devices).
565
630
  [connect-cloudant-store-url]: https://www.npmjs.com/package/connect-cloudant-store
566
631
  [connect-cloudant-store-image]: https://badgen.net/github/stars/adriantanasa/connect-cloudant-store?label=%E2%98%85
567
632
 
633
+ [![★][connect-cosmosdb-image] connect-cosmosdb][connect-cosmosdb-url] An Azure [Cosmos DB](https://azure.microsoft.com/en-us/products/cosmos-db/)-based session store.
634
+
635
+ [connect-cosmosdb-url]: https://www.npmjs.com/package/connect-cosmosdb
636
+ [connect-cosmosdb-image]: https://badgen.net/github/stars/thekillingspree/connect-cosmosdb?label=%E2%98%85
637
+
568
638
  [![★][connect-couchbase-image] connect-couchbase][connect-couchbase-url] A [couchbase](http://www.couchbase.com/)-based session store.
569
639
 
570
640
  [connect-couchbase-url]: https://www.npmjs.com/package/connect-couchbase
@@ -575,11 +645,6 @@ and other multi-core embedded devices).
575
645
  [connect-datacache-url]: https://www.npmjs.com/package/connect-datacache
576
646
  [connect-datacache-image]: https://badgen.net/github/stars/adriantanasa/connect-datacache?label=%E2%98%85
577
647
 
578
- [![★][@google-cloud/connect-datastore-image] @google-cloud/connect-datastore][@google-cloud/connect-datastore-url] A [Google Cloud Datastore](https://cloud.google.com/datastore/docs/concepts/overview)-based session store.
579
-
580
- [@google-cloud/connect-datastore-url]: https://www.npmjs.com/package/@google-cloud/connect-datastore
581
- [@google-cloud/connect-datastore-image]: https://badgen.net/github/stars/GoogleCloudPlatform/cloud-datastore-session-node?label=%E2%98%85
582
-
583
648
  [![★][connect-db2-image] connect-db2][connect-db2-url] An IBM DB2-based session store built using [ibm_db](https://www.npmjs.com/package/ibm_db) module.
584
649
 
585
650
  [connect-db2-url]: https://www.npmjs.com/package/connect-db2
@@ -590,11 +655,6 @@ and other multi-core embedded devices).
590
655
  [connect-dynamodb-url]: https://www.npmjs.com/package/connect-dynamodb
591
656
  [connect-dynamodb-image]: https://badgen.net/github/stars/ca98am79/connect-dynamodb?label=%E2%98%85
592
657
 
593
- [![★][@google-cloud/connect-firestore-image] @google-cloud/connect-firestore][@google-cloud/connect-firestore-url] A [Google Cloud Firestore](https://cloud.google.com/firestore/docs/overview)-based session store.
594
-
595
- [@google-cloud/connect-firestore-url]: https://www.npmjs.com/package/@google-cloud/connect-firestore
596
- [@google-cloud/connect-firestore-image]: https://badgen.net/github/stars/googleapis/nodejs-firestore-session?label=%E2%98%85
597
-
598
658
  [![★][connect-hazelcast-image] connect-hazelcast][connect-hazelcast-url] Hazelcast session store for Connect and Express.
599
659
 
600
660
  [connect-hazelcast-url]: https://www.npmjs.com/package/connect-hazelcast
@@ -651,6 +711,11 @@ and other multi-core embedded devices).
651
711
  [connect-neo4j-url]: https://www.npmjs.com/package/connect-neo4j
652
712
  [connect-neo4j-image]: https://badgen.net/github/stars/MaxAndersson/connect-neo4j?label=%E2%98%85
653
713
 
714
+ [![★][connect-ottoman-image] connect-ottoman][connect-ottoman-url] A [couchbase ottoman](http://www.couchbase.com/)-based session store.
715
+
716
+ [connect-ottoman-url]: https://www.npmjs.com/package/connect-ottoman
717
+ [connect-ottoman-image]: https://badgen.net/github/stars/noiissyboy/connect-ottoman?label=%E2%98%85
718
+
654
719
  [![★][connect-pg-simple-image] connect-pg-simple][connect-pg-simple-url] A PostgreSQL-based session store.
655
720
 
656
721
  [connect-pg-simple-url]: https://www.npmjs.com/package/connect-pg-simple
@@ -673,7 +738,7 @@ and other multi-core embedded devices).
673
738
  [connect-session-knex-image]: https://badgen.net/github/stars/llambda/connect-session-knex?label=%E2%98%85
674
739
 
675
740
  [![★][connect-session-sequelize-image] connect-session-sequelize][connect-session-sequelize-url] A session store using
676
- [Sequelize.js](http://sequelizejs.com/), which is a Node.js / io.js ORM for PostgreSQL, MySQL, SQLite and MSSQL.
741
+ [Sequelize.js](https://sequelize.org/), which is a Node.js / io.js ORM for PostgreSQL, MySQL, SQLite and MSSQL.
677
742
 
678
743
  [connect-session-sequelize-url]: https://www.npmjs.com/package/connect-session-sequelize
679
744
  [connect-session-sequelize-image]: https://badgen.net/github/stars/mweibel/connect-session-sequelize?label=%E2%98%85
@@ -737,7 +802,7 @@ a [variety of storage types](https://www.npmjs.com/package/cache-manager#store-e
737
802
  [express-session-level-url]: https://www.npmjs.com/package/express-session-level
738
803
  [express-session-level-image]: https://badgen.net/github/stars/tgohn/express-session-level?label=%E2%98%85
739
804
 
740
- [![★][express-session-rsdb-image] express-session-rsdb][express-session-rsdb-url] Session store based on Rocket-Store: A very simple, super fast and yet powerfull, flat file database.
805
+ [![★][express-session-rsdb-image] express-session-rsdb][express-session-rsdb-url] Session store based on Rocket-Store: A very simple, super fast and yet powerful, flat file database.
741
806
 
742
807
  [express-session-rsdb-url]: https://www.npmjs.com/package/express-session-rsdb
743
808
  [express-session-rsdb-image]: https://badgen.net/github/stars/paragi/express-session-rsdb?label=%E2%98%85
@@ -803,7 +868,7 @@ based session store. Supports all backends supported by Fortune (MongoDB, Redis,
803
868
  [restsession-url]: https://www.npmjs.com/package/restsession
804
869
  [restsession-image]: https://badgen.net/github/stars/jankal/restsession?label=%E2%98%85
805
870
 
806
- [![★][sequelstore-connect-image] sequelstore-connect][sequelstore-connect-url] A session store using [Sequelize.js](http://sequelizejs.com/).
871
+ [![★][sequelstore-connect-image] sequelstore-connect][sequelstore-connect-url] A session store using [Sequelize.js](https://sequelize.org/).
807
872
 
808
873
  [sequelstore-connect-url]: https://www.npmjs.com/package/sequelstore-connect
809
874
  [sequelstore-connect-image]: https://badgen.net/github/stars/MattMcFarland/sequelstore-connect?label=%E2%98%85
@@ -818,11 +883,6 @@ based session store. Supports all backends supported by Fortune (MongoDB, Redis,
818
883
  [session-pouchdb-store-url]: https://www.npmjs.com/package/session-pouchdb-store
819
884
  [session-pouchdb-store-image]: https://badgen.net/github/stars/solzimer/session-pouchdb-store?label=%E2%98%85
820
885
 
821
- [![★][session-rethinkdb-image] session-rethinkdb][session-rethinkdb-url] A [RethinkDB](http://rethinkdb.com/)-based session store.
822
-
823
- [session-rethinkdb-url]: https://www.npmjs.com/package/session-rethinkdb
824
- [session-rethinkdb-image]: https://badgen.net/github/stars/llambda/session-rethinkdb?label=%E2%98%85
825
-
826
886
  [![★][@databunker/session-store-image] @databunker/session-store][@databunker/session-store-url] A [Databunker](https://databunker.org/)-based encrypted session store.
827
887
 
828
888
  [@databunker/session-store-url]: https://www.npmjs.com/package/@databunker/session-store
@@ -983,7 +1043,10 @@ On Windows, use the corresponding command;
983
1043
 
984
1044
  [MIT](LICENSE)
985
1045
 
1046
+ [rfc-6265-5.1.4]: https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.4
986
1047
  [rfc-6265bis-03-4.1.2.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7
1048
+ [rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/
1049
+ [rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1
987
1050
  [ci-image]: https://badgen.net/github/checks/expressjs/session/master?label=ci
988
1051
  [ci-url]: https://github.com/expressjs/session/actions?query=workflow%3Aci
989
1052
  [coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/session/master
package/index.js CHANGED
@@ -70,7 +70,7 @@ var defer = typeof setImmediate === 'function'
70
70
  * Setup session store with the given `options`.
71
71
  *
72
72
  * @param {Object} [options]
73
- * @param {Object} [options.cookie] Options for cookie
73
+ * @param {Object|Function} [options.cookie] Options for cookie
74
74
  * @param {Function} [options.genid]
75
75
  * @param {String} [options.name=connect.sid] Session ID cookie name
76
76
  * @param {Boolean} [options.proxy]
@@ -158,10 +158,17 @@ function session(options) {
158
158
  store.generate = function(req){
159
159
  req.sessionID = generateId(req);
160
160
  req.session = new Session(req);
161
- req.session.cookie = new Cookie(cookieOptions);
161
+ var resolvedCookieOptions = typeof cookieOptions === 'function' ? cookieOptions(req) : cookieOptions;
162
+ req.session.cookie = new Cookie(resolvedCookieOptions);
162
163
 
163
- if (cookieOptions.secure === 'auto') {
164
- req.session.cookie.secure = issecure(req, trustProxy);
164
+ var isSecure = issecure(req, trustProxy);
165
+
166
+ if (resolvedCookieOptions.secure === 'auto') {
167
+ req.session.cookie.secure = isSecure;
168
+ }
169
+
170
+ if (resolvedCookieOptions.sameSite === 'auto') {
171
+ req.session.cookie.sameSite = isSecure ? 'none' : 'lax';
165
172
  }
166
173
  };
167
174
 
@@ -193,7 +200,15 @@ function session(options) {
193
200
 
194
201
  // pathname mismatch
195
202
  var originalPath = parseUrl.original(req).pathname || '/'
196
- if (originalPath.indexOf(cookieOptions.path || '/') !== 0) return next();
203
+ var resolvedCookieOptions = typeof cookieOptions === 'function' ? cookieOptions(req) : cookieOptions
204
+ var cfgPath = resolvedCookieOptions.path || '/'
205
+
206
+ if (!rfcPathMatch(originalPath, cfgPath)) {
207
+ debug('pathname mismatch')
208
+ next()
209
+ return
210
+ }
211
+
197
212
 
198
213
  // ensure a secret is available or bail
199
214
  if (!secret && !req.secret) {
@@ -244,7 +259,11 @@ function session(options) {
244
259
  }
245
260
 
246
261
  // set cookie
247
- setcookie(res, name, req.sessionID, secrets[0], req.session.cookie.data);
262
+ try {
263
+ setcookie(res, name, req.sessionID, secrets[0], req.session.cookie.data)
264
+ } catch (err) {
265
+ defer(next, err)
266
+ }
248
267
  });
249
268
 
250
269
  // proxy end() to commit the session
@@ -512,6 +531,42 @@ function session(options) {
512
531
  };
513
532
  };
514
533
 
534
+ /**
535
+ * Check if the cookiePath matches the requestPath following the
536
+ * rules in RFC 6265 section 5.1.4.
537
+ *
538
+ * @param {String} requestPath
539
+ * @param {String} cookiePath
540
+ * @return {Boolean}
541
+ * @private
542
+ */
543
+
544
+ function rfcPathMatch(requestPath, cookiePath) {
545
+ // Normalize inputs (Node 0.8-safe)
546
+ requestPath = (typeof requestPath === 'string' && requestPath.length) ? requestPath : '/';
547
+ cookiePath = (typeof cookiePath === 'string' && cookiePath.length) ? cookiePath : '/';
548
+
549
+ // Root cookie matches everything
550
+ if (cookiePath === '/') return true;
551
+
552
+ // Exact match
553
+ if (requestPath === cookiePath) return true;
554
+
555
+ // Prefix match
556
+ if (requestPath.indexOf(cookiePath) === 0) {
557
+ // If cookiePath ends with '/', any longer requestPath is OK
558
+ if (cookiePath.charAt(cookiePath.length - 1) === '/') return true;
559
+
560
+ // Otherwise the next char after the prefix must be '/'
561
+ var nextChar = requestPath.length > cookiePath.length
562
+ ? requestPath.charAt(cookiePath.length)
563
+ : '';
564
+ return nextChar === '/';
565
+ }
566
+
567
+ return false;
568
+ }
569
+
515
570
  /**
516
571
  * Generate a session ID for a new session.
517
572
  *
@@ -519,7 +574,7 @@ function session(options) {
519
574
  * @private
520
575
  */
521
576
 
522
- function generateSessionId(sess) {
577
+ function generateSessionId() {
523
578
  return uid(24);
524
579
  }
525
580
 
@@ -542,7 +597,7 @@ function getcookie(req, name, secrets) {
542
597
  raw = cookies[name];
543
598
 
544
599
  if (raw) {
545
- if (raw.substr(0, 2) === 's:') {
600
+ if (raw.slice(0, 2) === 's:') {
546
601
  val = unsigncookie(raw.slice(2), secrets);
547
602
 
548
603
  if (val === false) {
@@ -573,7 +628,7 @@ function getcookie(req, name, secrets) {
573
628
  raw = req.cookies[name];
574
629
 
575
630
  if (raw) {
576
- if (raw.substr(0, 2) === 's:') {
631
+ if (raw.slice(0, 2) === 's:') {
577
632
  val = unsigncookie(raw.slice(2), secrets);
578
633
 
579
634
  if (val) {
@@ -630,7 +685,8 @@ function hash(sess) {
630
685
 
631
686
  function issecure(req, trustProxy) {
632
687
  // socket is https server
633
- if (req.connection && req.connection.encrypted) {
688
+ var socket = req.socket || req.connection;
689
+ if (socket && socket.encrypted) {
634
690
  return true;
635
691
  }
636
692
 
@@ -648,7 +704,7 @@ function issecure(req, trustProxy) {
648
704
  var header = req.headers['x-forwarded-proto'] || '';
649
705
  var index = header.indexOf(',');
650
706
  var proto = index !== -1
651
- ? header.substr(0, index).toLowerCase().trim()
707
+ ? header.slice(0, index).toLowerCase().trim()
652
708
  : header.toLowerCase().trim()
653
709
 
654
710
  return proto === 'https';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plotdb/express-session",
3
- "version": "1.17.4",
3
+ "version": "1.19.1",
4
4
  "description": "Simple session middleware for Express ( PlotDB Forked version )",
5
5
  "author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
6
6
  "contributors": [
@@ -8,30 +8,33 @@
8
8
  "Joe Wagner <njwjs722@gmail.com>"
9
9
  ],
10
10
  "repository": "plotdb/express-session",
11
+ "funding": {
12
+ "type": "opencollective",
13
+ "url": "https://opencollective.com/express"
14
+ },
11
15
  "license": "MIT",
12
16
  "dependencies": {
13
- "cookie": "^0.7.2",
14
- "cookie-signature": "1.0.6",
15
- "debug": "2.6.9",
17
+ "cookie": "~0.7.2",
18
+ "cookie-signature": "~1.0.7",
19
+ "debug": "~2.6.9",
16
20
  "depd": "~2.0.0",
17
21
  "on-headers": "~1.1.0",
18
22
  "parseurl": "~1.3.3",
19
- "safe-buffer": "5.2.1",
23
+ "safe-buffer": "~5.2.1",
20
24
  "uid-safe": "~2.1.5"
21
25
  },
22
26
  "devDependencies": {
23
27
  "after": "0.8.2",
24
28
  "cookie-parser": "1.4.6",
25
- "eslint": "7.32.0",
26
- "eslint-plugin-markdown": "2.2.1",
29
+ "eslint": "8.56.0",
30
+ "eslint-plugin-markdown": "3.0.1",
27
31
  "express": "4.17.3",
28
- "mocha": "10.0.0",
29
- "nyc": "15.1.0",
30
- "supertest": "6.2.3"
32
+ "mocha": "12.0.3",
33
+ "nyc": "18.0.0",
34
+ "supertest": "7.3.1"
31
35
  },
32
36
  "files": [
33
37
  "session/",
34
- "HISTORY.md",
35
38
  "index.js"
36
39
  ],
37
40
  "engines": {
@@ -39,7 +42,7 @@
39
42
  },
40
43
  "scripts": {
41
44
  "lint": "eslint . && node ./scripts/lint-readme.js",
42
- "test": "mocha --require test/support/env --check-leaks --bail --no-exit --reporter spec test/",
45
+ "test": "./test/support/gencert.sh && mocha --require test/support/env --check-leaks --no-exit --reporter spec test/",
43
46
  "test-ci": "nyc --reporter=lcov --reporter=text npm test",
44
47
  "test-cov": "nyc npm test",
45
48
  "version": "node scripts/version-history.js && git add HISTORY.md"
package/session/cookie.js CHANGED
@@ -116,7 +116,9 @@ Cookie.prototype = {
116
116
 
117
117
  get data() {
118
118
  return {
119
- originalMaxAge: this.originalMaxAge
119
+ originalMaxAge: this.originalMaxAge,
120
+ partitioned: this.partitioned,
121
+ priority: this.priority
120
122
  , expires: this._expires
121
123
  , secure: this.secure
122
124
  , httpOnly: this.httpOnly
package/HISTORY.md DELETED
@@ -1,450 +0,0 @@
1
- 1.17.4 / 2026-11-29
2
- ===================
3
-
4
- * deps: cookie@^0.7.2
5
- - Fix GHSA-pxg6-pf52-xh8x
6
- * deps: on-headers@~1.1.0
7
- - Fix GHSA-76c9-3jph-rj3q
8
-
9
- 1.17.3 / 2022-05-11
10
- ===================
11
-
12
- * Fix resaving already-saved new session at end of request
13
- * deps: cookie@0.4.2
14
-
15
- 1.17.2 / 2021-05-19
16
- ===================
17
-
18
- * Fix `res.end` patch to always commit headers
19
- * deps: cookie@0.4.1
20
- * deps: safe-buffer@5.2.1
21
-
22
- 1.17.1 / 2020-04-16
23
- ===================
24
-
25
- * Fix internal method wrapping error on failed reloads
26
-
27
- 1.17.0 / 2019-10-10
28
- ===================
29
-
30
- * deps: cookie@0.4.0
31
- - Add `SameSite=None` support
32
- * deps: safe-buffer@5.2.0
33
-
34
- 1.16.2 / 2019-06-12
35
- ===================
36
-
37
- * Fix restoring `cookie.originalMaxAge` when store returns `Date`
38
- * deps: parseurl@~1.3.3
39
-
40
- 1.16.1 / 2019-04-11
41
- ===================
42
-
43
- * Fix error passing `data` option to `Cookie` constructor
44
- * Fix uncaught error from bad session data
45
-
46
- 1.16.0 / 2019-04-10
47
- ===================
48
-
49
- * Catch invalid `cookie.maxAge` value earlier
50
- * Deprecate setting `cookie.maxAge` to a `Date` object
51
- * Fix issue where `resave: false` may not save altered sessions
52
- * Remove `utils-merge` dependency
53
- * Use `safe-buffer` for improved Buffer API
54
- * Use `Set-Cookie` as cookie header name for compatibility
55
- * deps: depd@~2.0.0
56
- - Replace internal `eval` usage with `Function` constructor
57
- - Use instance methods on `process` to check for listeners
58
- - perf: remove argument reassignment
59
- * deps: on-headers@~1.0.2
60
- - Fix `res.writeHead` patch missing return value
61
-
62
- 1.15.6 / 2017-09-26
63
- ===================
64
-
65
- * deps: debug@2.6.9
66
- * deps: parseurl@~1.3.2
67
- - perf: reduce overhead for full URLs
68
- - perf: unroll the "fast-path" `RegExp`
69
- * deps: uid-safe@~2.1.5
70
- - perf: remove only trailing `=`
71
- * deps: utils-merge@1.0.1
72
-
73
- 1.15.5 / 2017-08-02
74
- ===================
75
-
76
- * Fix `TypeError` when `req.url` is an empty string
77
- * deps: depd@~1.1.1
78
- - Remove unnecessary `Buffer` loading
79
-
80
- 1.15.4 / 2017-07-18
81
- ===================
82
-
83
- * deps: debug@2.6.8
84
-
85
- 1.15.3 / 2017-05-17
86
- ===================
87
-
88
- * deps: debug@2.6.7
89
- - deps: ms@2.0.0
90
-
91
- 1.15.2 / 2017-03-26
92
- ===================
93
-
94
- * deps: debug@2.6.3
95
- - Fix `DEBUG_MAX_ARRAY_LENGTH`
96
- * deps: uid-safe@~2.1.4
97
- - Remove `base64-url` dependency
98
-
99
- 1.15.1 / 2017-02-10
100
- ===================
101
-
102
- * deps: debug@2.6.1
103
- - Fix deprecation messages in WebStorm and other editors
104
- - Undeprecate `DEBUG_FD` set to `1` or `2`
105
-
106
- 1.15.0 / 2017-01-22
107
- ===================
108
-
109
- * Fix detecting modified session when session contains "cookie" property
110
- * Fix resaving already-saved reloaded session at end of request
111
- * deps: crc@3.4.4
112
- - perf: use `Buffer.from` when available
113
- * deps: debug@2.6.0
114
- - Allow colors in workers
115
- - Deprecated `DEBUG_FD` environment variable
116
- - Use same color for same namespace
117
- - Fix error when running under React Native
118
- - deps: ms@0.7.2
119
- * perf: remove unreachable branch in set-cookie method
120
-
121
- 1.14.2 / 2016-10-30
122
- ===================
123
-
124
- * deps: crc@3.4.1
125
- - Fix deprecation warning in Node.js 7.x
126
- * deps: uid-safe@~2.1.3
127
- - deps: base64-url@1.3.3
128
-
129
- 1.14.1 / 2016-08-24
130
- ===================
131
-
132
- * Fix not always resetting session max age before session save
133
- * Fix the cookie `sameSite` option to actually alter the `Set-Cookie`
134
- * deps: uid-safe@~2.1.2
135
- - deps: base64-url@1.3.2
136
-
137
- 1.14.0 / 2016-07-01
138
- ===================
139
-
140
- * Correctly inherit from `EventEmitter` class in `Store` base class
141
- * Fix issue where `Set-Cookie` `Expires` was not always updated
142
- * Methods are no longer enumerable on `req.session` object
143
- * deps: cookie@0.3.1
144
- - Add `sameSite` option
145
- - Improve error message when `encode` is not a function
146
- - Improve error message when `expires` is not a `Date`
147
- - perf: enable strict mode
148
- - perf: use for loop in parse
149
- - perf: use string concatination for serialization
150
- * deps: parseurl@~1.3.1
151
- - perf: enable strict mode
152
- * deps: uid-safe@~2.1.1
153
- - Use `random-bytes` for byte source
154
- - deps: base64-url@1.2.2
155
- * perf: enable strict mode
156
- * perf: remove argument reassignment
157
-
158
- 1.13.0 / 2016-01-10
159
- ===================
160
-
161
- * Fix `rolling: true` to not set cookie when no session exists
162
- - Better `saveUninitialized: false` + `rolling: true` behavior
163
- * deps: crc@3.4.0
164
-
165
- 1.12.1 / 2015-10-29
166
- ===================
167
-
168
- * deps: cookie@0.2.3
169
- - Fix cookie `Max-Age` to never be a floating point number
170
-
171
- 1.12.0 / 2015-10-25
172
- ===================
173
-
174
- * Support the value `'auto'` in the `cookie.secure` option
175
- * deps: cookie@0.2.2
176
- - Throw on invalid values provided to `serialize`
177
- * deps: depd@~1.1.0
178
- - Enable strict mode in more places
179
- - Support web browser loading
180
- * deps: on-headers@~1.0.1
181
- - perf: enable strict mode
182
-
183
- 1.11.3 / 2015-05-22
184
- ===================
185
-
186
- * deps: cookie@0.1.3
187
- - Slight optimizations
188
- * deps: crc@3.3.0
189
-
190
- 1.11.2 / 2015-05-10
191
- ===================
192
-
193
- * deps: debug@~2.2.0
194
- - deps: ms@0.7.1
195
- * deps: uid-safe@~2.0.0
196
-
197
- 1.11.1 / 2015-04-08
198
- ===================
199
-
200
- * Fix mutating `options.secret` value
201
-
202
- 1.11.0 / 2015-04-07
203
- ===================
204
-
205
- * Support an array in `secret` option for key rotation
206
- * deps: depd@~1.0.1
207
-
208
- 1.10.4 / 2015-03-15
209
- ===================
210
-
211
- * deps: debug@~2.1.3
212
- - Fix high intensity foreground color for bold
213
- - deps: ms@0.7.0
214
-
215
- 1.10.3 / 2015-02-16
216
- ===================
217
-
218
- * deps: cookie-signature@1.0.6
219
- * deps: uid-safe@1.1.0
220
- - Use `crypto.randomBytes`, if available
221
- - deps: base64-url@1.2.1
222
-
223
- 1.10.2 / 2015-01-31
224
- ===================
225
-
226
- * deps: uid-safe@1.0.3
227
- - Fix error branch that would throw
228
- - deps: base64-url@1.2.0
229
-
230
- 1.10.1 / 2015-01-08
231
- ===================
232
-
233
- * deps: uid-safe@1.0.2
234
- - Remove dependency on `mz`
235
-
236
- 1.10.0 / 2015-01-05
237
- ===================
238
-
239
- * Add `store.touch` interface for session stores
240
- * Fix `MemoryStore` expiration with `resave: false`
241
- * deps: debug@~2.1.1
242
-
243
- 1.9.3 / 2014-12-02
244
- ==================
245
-
246
- * Fix error when `req.sessionID` contains a non-string value
247
-
248
- 1.9.2 / 2014-11-22
249
- ==================
250
-
251
- * deps: crc@3.2.1
252
- - Minor fixes
253
-
254
- 1.9.1 / 2014-10-22
255
- ==================
256
-
257
- * Remove unnecessary empty write call
258
- - Fixes Node.js 0.11.14 behavior change
259
- - Helps work-around Node.js 0.10.1 zlib bug
260
-
261
- 1.9.0 / 2014-09-16
262
- ==================
263
-
264
- * deps: debug@~2.1.0
265
- - Implement `DEBUG_FD` env variable support
266
- * deps: depd@~1.0.0
267
-
268
- 1.8.2 / 2014-09-15
269
- ==================
270
-
271
- * Use `crc` instead of `buffer-crc32` for speed
272
- * deps: depd@0.4.5
273
-
274
- 1.8.1 / 2014-09-08
275
- ==================
276
-
277
- * Keep `req.session.save` non-enumerable
278
- * Prevent session prototype methods from being overwritten
279
-
280
- 1.8.0 / 2014-09-07
281
- ==================
282
-
283
- * Do not resave already-saved session at end of request
284
- * deps: cookie-signature@1.0.5
285
- * deps: debug@~2.0.0
286
-
287
- 1.7.6 / 2014-08-18
288
- ==================
289
-
290
- * Fix exception on `res.end(null)` calls
291
-
292
- 1.7.5 / 2014-08-10
293
- ==================
294
-
295
- * Fix parsing original URL
296
- * deps: on-headers@~1.0.0
297
- * deps: parseurl@~1.3.0
298
-
299
- 1.7.4 / 2014-08-05
300
- ==================
301
-
302
- * Fix response end delay for non-chunked responses
303
-
304
- 1.7.3 / 2014-08-05
305
- ==================
306
-
307
- * Fix `res.end` patch to call correct upstream `res.write`
308
-
309
- 1.7.2 / 2014-07-27
310
- ==================
311
-
312
- * deps: depd@0.4.4
313
- - Work-around v8 generating empty stack traces
314
-
315
- 1.7.1 / 2014-07-26
316
- ==================
317
-
318
- * deps: depd@0.4.3
319
- - Fix exception when global `Error.stackTraceLimit` is too low
320
-
321
- 1.7.0 / 2014-07-22
322
- ==================
323
-
324
- * Improve session-ending error handling
325
- - Errors are passed to `next(err)` instead of `console.error`
326
- * deps: debug@1.0.4
327
- * deps: depd@0.4.2
328
- - Add `TRACE_DEPRECATION` environment variable
329
- - Remove non-standard grey color from color output
330
- - Support `--no-deprecation` argument
331
- - Support `--trace-deprecation` argument
332
-
333
- 1.6.5 / 2014-07-11
334
- ==================
335
-
336
- * Do not require `req.originalUrl`
337
- * deps: debug@1.0.3
338
- - Add support for multiple wildcards in namespaces
339
-
340
- 1.6.4 / 2014-07-07
341
- ==================
342
-
343
- * Fix blank responses for stores with synchronous operations
344
-
345
- 1.6.3 / 2014-07-04
346
- ==================
347
-
348
- * Fix resave deprecation message
349
-
350
- 1.6.2 / 2014-07-04
351
- ==================
352
-
353
- * Fix confusing option deprecation messages
354
-
355
- 1.6.1 / 2014-06-28
356
- ==================
357
-
358
- * Fix saveUninitialized deprecation message
359
-
360
- 1.6.0 / 2014-06-28
361
- ==================
362
-
363
- * Add deprecation message to undefined `resave` option
364
- * Add deprecation message to undefined `saveUninitialized` option
365
- * Fix `res.end` patch to return correct value
366
- * Fix `res.end` patch to handle multiple `res.end` calls
367
- * Reject cookies with missing signatures
368
-
369
- 1.5.2 / 2014-06-26
370
- ==================
371
-
372
- * deps: cookie-signature@1.0.4
373
- - fix for timing attacks
374
-
375
- 1.5.1 / 2014-06-21
376
- ==================
377
-
378
- * Move hard-to-track-down `req.secret` deprecation message
379
-
380
- 1.5.0 / 2014-06-19
381
- ==================
382
-
383
- * Debug name is now "express-session"
384
- * Deprecate integration with `cookie-parser` middleware
385
- * Deprecate looking for secret in `req.secret`
386
- * Directly read cookies; `cookie-parser` no longer required
387
- * Directly set cookies; `res.cookie` no longer required
388
- * Generate session IDs with `uid-safe`, faster and even less collisions
389
-
390
- 1.4.0 / 2014-06-17
391
- ==================
392
-
393
- * Add `genid` option to generate custom session IDs
394
- * Add `saveUninitialized` option to control saving uninitialized sessions
395
- * Add `unset` option to control unsetting `req.session`
396
- * Generate session IDs with `rand-token` by default; reduce collisions
397
- * deps: buffer-crc32@0.2.3
398
-
399
- 1.3.1 / 2014-06-14
400
- ==================
401
-
402
- * Add description in package for npmjs.org listing
403
-
404
- 1.3.0 / 2014-06-14
405
- ==================
406
-
407
- * Integrate with express "trust proxy" by default
408
- * deps: debug@1.0.2
409
-
410
- 1.2.1 / 2014-05-27
411
- ==================
412
-
413
- * Fix `resave` such that `resave: true` works
414
-
415
- 1.2.0 / 2014-05-19
416
- ==================
417
-
418
- * Add `resave` option to control saving unmodified sessions
419
-
420
- 1.1.0 / 2014-05-12
421
- ==================
422
-
423
- * Add `name` option; replacement for `key` option
424
- * Use `setImmediate` in MemoryStore for node.js >= 0.10
425
-
426
- 1.0.4 / 2014-04-27
427
- ==================
428
-
429
- * deps: debug@0.8.1
430
-
431
- 1.0.3 / 2014-04-19
432
- ==================
433
-
434
- * Use `res.cookie()` instead of `res.setHeader()`
435
- * deps: cookie@0.1.2
436
-
437
- 1.0.2 / 2014-02-23
438
- ==================
439
-
440
- * Add missing dependency to `package.json`
441
-
442
- 1.0.1 / 2014-02-15
443
- ==================
444
-
445
- * Add missing dependencies to `package.json`
446
-
447
- 1.0.0 / 2014-02-15
448
- ==================
449
-
450
- * Genesis from `connect`