@plotdb/express-session 1.17.3 → 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.3",
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.4.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
- "on-headers": "~1.0.2",
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,442 +0,0 @@
1
- 1.17.3 / 2022-05-11
2
- ===================
3
-
4
- * Fix resaving already-saved new session at end of request
5
- * deps: cookie@0.4.2
6
-
7
- 1.17.2 / 2021-05-19
8
- ===================
9
-
10
- * Fix `res.end` patch to always commit headers
11
- * deps: cookie@0.4.1
12
- * deps: safe-buffer@5.2.1
13
-
14
- 1.17.1 / 2020-04-16
15
- ===================
16
-
17
- * Fix internal method wrapping error on failed reloads
18
-
19
- 1.17.0 / 2019-10-10
20
- ===================
21
-
22
- * deps: cookie@0.4.0
23
- - Add `SameSite=None` support
24
- * deps: safe-buffer@5.2.0
25
-
26
- 1.16.2 / 2019-06-12
27
- ===================
28
-
29
- * Fix restoring `cookie.originalMaxAge` when store returns `Date`
30
- * deps: parseurl@~1.3.3
31
-
32
- 1.16.1 / 2019-04-11
33
- ===================
34
-
35
- * Fix error passing `data` option to `Cookie` constructor
36
- * Fix uncaught error from bad session data
37
-
38
- 1.16.0 / 2019-04-10
39
- ===================
40
-
41
- * Catch invalid `cookie.maxAge` value earlier
42
- * Deprecate setting `cookie.maxAge` to a `Date` object
43
- * Fix issue where `resave: false` may not save altered sessions
44
- * Remove `utils-merge` dependency
45
- * Use `safe-buffer` for improved Buffer API
46
- * Use `Set-Cookie` as cookie header name for compatibility
47
- * deps: depd@~2.0.0
48
- - Replace internal `eval` usage with `Function` constructor
49
- - Use instance methods on `process` to check for listeners
50
- - perf: remove argument reassignment
51
- * deps: on-headers@~1.0.2
52
- - Fix `res.writeHead` patch missing return value
53
-
54
- 1.15.6 / 2017-09-26
55
- ===================
56
-
57
- * deps: debug@2.6.9
58
- * deps: parseurl@~1.3.2
59
- - perf: reduce overhead for full URLs
60
- - perf: unroll the "fast-path" `RegExp`
61
- * deps: uid-safe@~2.1.5
62
- - perf: remove only trailing `=`
63
- * deps: utils-merge@1.0.1
64
-
65
- 1.15.5 / 2017-08-02
66
- ===================
67
-
68
- * Fix `TypeError` when `req.url` is an empty string
69
- * deps: depd@~1.1.1
70
- - Remove unnecessary `Buffer` loading
71
-
72
- 1.15.4 / 2017-07-18
73
- ===================
74
-
75
- * deps: debug@2.6.8
76
-
77
- 1.15.3 / 2017-05-17
78
- ===================
79
-
80
- * deps: debug@2.6.7
81
- - deps: ms@2.0.0
82
-
83
- 1.15.2 / 2017-03-26
84
- ===================
85
-
86
- * deps: debug@2.6.3
87
- - Fix `DEBUG_MAX_ARRAY_LENGTH`
88
- * deps: uid-safe@~2.1.4
89
- - Remove `base64-url` dependency
90
-
91
- 1.15.1 / 2017-02-10
92
- ===================
93
-
94
- * deps: debug@2.6.1
95
- - Fix deprecation messages in WebStorm and other editors
96
- - Undeprecate `DEBUG_FD` set to `1` or `2`
97
-
98
- 1.15.0 / 2017-01-22
99
- ===================
100
-
101
- * Fix detecting modified session when session contains "cookie" property
102
- * Fix resaving already-saved reloaded session at end of request
103
- * deps: crc@3.4.4
104
- - perf: use `Buffer.from` when available
105
- * deps: debug@2.6.0
106
- - Allow colors in workers
107
- - Deprecated `DEBUG_FD` environment variable
108
- - Use same color for same namespace
109
- - Fix error when running under React Native
110
- - deps: ms@0.7.2
111
- * perf: remove unreachable branch in set-cookie method
112
-
113
- 1.14.2 / 2016-10-30
114
- ===================
115
-
116
- * deps: crc@3.4.1
117
- - Fix deprecation warning in Node.js 7.x
118
- * deps: uid-safe@~2.1.3
119
- - deps: base64-url@1.3.3
120
-
121
- 1.14.1 / 2016-08-24
122
- ===================
123
-
124
- * Fix not always resetting session max age before session save
125
- * Fix the cookie `sameSite` option to actually alter the `Set-Cookie`
126
- * deps: uid-safe@~2.1.2
127
- - deps: base64-url@1.3.2
128
-
129
- 1.14.0 / 2016-07-01
130
- ===================
131
-
132
- * Correctly inherit from `EventEmitter` class in `Store` base class
133
- * Fix issue where `Set-Cookie` `Expires` was not always updated
134
- * Methods are no longer enumerable on `req.session` object
135
- * deps: cookie@0.3.1
136
- - Add `sameSite` option
137
- - Improve error message when `encode` is not a function
138
- - Improve error message when `expires` is not a `Date`
139
- - perf: enable strict mode
140
- - perf: use for loop in parse
141
- - perf: use string concatination for serialization
142
- * deps: parseurl@~1.3.1
143
- - perf: enable strict mode
144
- * deps: uid-safe@~2.1.1
145
- - Use `random-bytes` for byte source
146
- - deps: base64-url@1.2.2
147
- * perf: enable strict mode
148
- * perf: remove argument reassignment
149
-
150
- 1.13.0 / 2016-01-10
151
- ===================
152
-
153
- * Fix `rolling: true` to not set cookie when no session exists
154
- - Better `saveUninitialized: false` + `rolling: true` behavior
155
- * deps: crc@3.4.0
156
-
157
- 1.12.1 / 2015-10-29
158
- ===================
159
-
160
- * deps: cookie@0.2.3
161
- - Fix cookie `Max-Age` to never be a floating point number
162
-
163
- 1.12.0 / 2015-10-25
164
- ===================
165
-
166
- * Support the value `'auto'` in the `cookie.secure` option
167
- * deps: cookie@0.2.2
168
- - Throw on invalid values provided to `serialize`
169
- * deps: depd@~1.1.0
170
- - Enable strict mode in more places
171
- - Support web browser loading
172
- * deps: on-headers@~1.0.1
173
- - perf: enable strict mode
174
-
175
- 1.11.3 / 2015-05-22
176
- ===================
177
-
178
- * deps: cookie@0.1.3
179
- - Slight optimizations
180
- * deps: crc@3.3.0
181
-
182
- 1.11.2 / 2015-05-10
183
- ===================
184
-
185
- * deps: debug@~2.2.0
186
- - deps: ms@0.7.1
187
- * deps: uid-safe@~2.0.0
188
-
189
- 1.11.1 / 2015-04-08
190
- ===================
191
-
192
- * Fix mutating `options.secret` value
193
-
194
- 1.11.0 / 2015-04-07
195
- ===================
196
-
197
- * Support an array in `secret` option for key rotation
198
- * deps: depd@~1.0.1
199
-
200
- 1.10.4 / 2015-03-15
201
- ===================
202
-
203
- * deps: debug@~2.1.3
204
- - Fix high intensity foreground color for bold
205
- - deps: ms@0.7.0
206
-
207
- 1.10.3 / 2015-02-16
208
- ===================
209
-
210
- * deps: cookie-signature@1.0.6
211
- * deps: uid-safe@1.1.0
212
- - Use `crypto.randomBytes`, if available
213
- - deps: base64-url@1.2.1
214
-
215
- 1.10.2 / 2015-01-31
216
- ===================
217
-
218
- * deps: uid-safe@1.0.3
219
- - Fix error branch that would throw
220
- - deps: base64-url@1.2.0
221
-
222
- 1.10.1 / 2015-01-08
223
- ===================
224
-
225
- * deps: uid-safe@1.0.2
226
- - Remove dependency on `mz`
227
-
228
- 1.10.0 / 2015-01-05
229
- ===================
230
-
231
- * Add `store.touch` interface for session stores
232
- * Fix `MemoryStore` expiration with `resave: false`
233
- * deps: debug@~2.1.1
234
-
235
- 1.9.3 / 2014-12-02
236
- ==================
237
-
238
- * Fix error when `req.sessionID` contains a non-string value
239
-
240
- 1.9.2 / 2014-11-22
241
- ==================
242
-
243
- * deps: crc@3.2.1
244
- - Minor fixes
245
-
246
- 1.9.1 / 2014-10-22
247
- ==================
248
-
249
- * Remove unnecessary empty write call
250
- - Fixes Node.js 0.11.14 behavior change
251
- - Helps work-around Node.js 0.10.1 zlib bug
252
-
253
- 1.9.0 / 2014-09-16
254
- ==================
255
-
256
- * deps: debug@~2.1.0
257
- - Implement `DEBUG_FD` env variable support
258
- * deps: depd@~1.0.0
259
-
260
- 1.8.2 / 2014-09-15
261
- ==================
262
-
263
- * Use `crc` instead of `buffer-crc32` for speed
264
- * deps: depd@0.4.5
265
-
266
- 1.8.1 / 2014-09-08
267
- ==================
268
-
269
- * Keep `req.session.save` non-enumerable
270
- * Prevent session prototype methods from being overwritten
271
-
272
- 1.8.0 / 2014-09-07
273
- ==================
274
-
275
- * Do not resave already-saved session at end of request
276
- * deps: cookie-signature@1.0.5
277
- * deps: debug@~2.0.0
278
-
279
- 1.7.6 / 2014-08-18
280
- ==================
281
-
282
- * Fix exception on `res.end(null)` calls
283
-
284
- 1.7.5 / 2014-08-10
285
- ==================
286
-
287
- * Fix parsing original URL
288
- * deps: on-headers@~1.0.0
289
- * deps: parseurl@~1.3.0
290
-
291
- 1.7.4 / 2014-08-05
292
- ==================
293
-
294
- * Fix response end delay for non-chunked responses
295
-
296
- 1.7.3 / 2014-08-05
297
- ==================
298
-
299
- * Fix `res.end` patch to call correct upstream `res.write`
300
-
301
- 1.7.2 / 2014-07-27
302
- ==================
303
-
304
- * deps: depd@0.4.4
305
- - Work-around v8 generating empty stack traces
306
-
307
- 1.7.1 / 2014-07-26
308
- ==================
309
-
310
- * deps: depd@0.4.3
311
- - Fix exception when global `Error.stackTraceLimit` is too low
312
-
313
- 1.7.0 / 2014-07-22
314
- ==================
315
-
316
- * Improve session-ending error handling
317
- - Errors are passed to `next(err)` instead of `console.error`
318
- * deps: debug@1.0.4
319
- * deps: depd@0.4.2
320
- - Add `TRACE_DEPRECATION` environment variable
321
- - Remove non-standard grey color from color output
322
- - Support `--no-deprecation` argument
323
- - Support `--trace-deprecation` argument
324
-
325
- 1.6.5 / 2014-07-11
326
- ==================
327
-
328
- * Do not require `req.originalUrl`
329
- * deps: debug@1.0.3
330
- - Add support for multiple wildcards in namespaces
331
-
332
- 1.6.4 / 2014-07-07
333
- ==================
334
-
335
- * Fix blank responses for stores with synchronous operations
336
-
337
- 1.6.3 / 2014-07-04
338
- ==================
339
-
340
- * Fix resave deprecation message
341
-
342
- 1.6.2 / 2014-07-04
343
- ==================
344
-
345
- * Fix confusing option deprecation messages
346
-
347
- 1.6.1 / 2014-06-28
348
- ==================
349
-
350
- * Fix saveUninitialized deprecation message
351
-
352
- 1.6.0 / 2014-06-28
353
- ==================
354
-
355
- * Add deprecation message to undefined `resave` option
356
- * Add deprecation message to undefined `saveUninitialized` option
357
- * Fix `res.end` patch to return correct value
358
- * Fix `res.end` patch to handle multiple `res.end` calls
359
- * Reject cookies with missing signatures
360
-
361
- 1.5.2 / 2014-06-26
362
- ==================
363
-
364
- * deps: cookie-signature@1.0.4
365
- - fix for timing attacks
366
-
367
- 1.5.1 / 2014-06-21
368
- ==================
369
-
370
- * Move hard-to-track-down `req.secret` deprecation message
371
-
372
- 1.5.0 / 2014-06-19
373
- ==================
374
-
375
- * Debug name is now "express-session"
376
- * Deprecate integration with `cookie-parser` middleware
377
- * Deprecate looking for secret in `req.secret`
378
- * Directly read cookies; `cookie-parser` no longer required
379
- * Directly set cookies; `res.cookie` no longer required
380
- * Generate session IDs with `uid-safe`, faster and even less collisions
381
-
382
- 1.4.0 / 2014-06-17
383
- ==================
384
-
385
- * Add `genid` option to generate custom session IDs
386
- * Add `saveUninitialized` option to control saving uninitialized sessions
387
- * Add `unset` option to control unsetting `req.session`
388
- * Generate session IDs with `rand-token` by default; reduce collisions
389
- * deps: buffer-crc32@0.2.3
390
-
391
- 1.3.1 / 2014-06-14
392
- ==================
393
-
394
- * Add description in package for npmjs.org listing
395
-
396
- 1.3.0 / 2014-06-14
397
- ==================
398
-
399
- * Integrate with express "trust proxy" by default
400
- * deps: debug@1.0.2
401
-
402
- 1.2.1 / 2014-05-27
403
- ==================
404
-
405
- * Fix `resave` such that `resave: true` works
406
-
407
- 1.2.0 / 2014-05-19
408
- ==================
409
-
410
- * Add `resave` option to control saving unmodified sessions
411
-
412
- 1.1.0 / 2014-05-12
413
- ==================
414
-
415
- * Add `name` option; replacement for `key` option
416
- * Use `setImmediate` in MemoryStore for node.js >= 0.10
417
-
418
- 1.0.4 / 2014-04-27
419
- ==================
420
-
421
- * deps: debug@0.8.1
422
-
423
- 1.0.3 / 2014-04-19
424
- ==================
425
-
426
- * Use `res.cookie()` instead of `res.setHeader()`
427
- * deps: cookie@0.1.2
428
-
429
- 1.0.2 / 2014-02-23
430
- ==================
431
-
432
- * Add missing dependency to `package.json`
433
-
434
- 1.0.1 / 2014-02-15
435
- ==================
436
-
437
- * Add missing dependencies to `package.json`
438
-
439
- 1.0.0 / 2014-02-15
440
- ==================
441
-
442
- * Genesis from `connect`