108 Commits
Author SHA1 Message Date
b6f151362a refactor: replace deprecated substr() with slice() (#1099)
Replace all instances of String.prototype.substr() with String.prototype.slice()
to use the standard, non-deprecated method. This maintains compatibility with
Node.js >= 0.8.0 while following modern JavaScript best practices.

All replacements maintain identical functionality as slice() and substr() behave
the same for these use cases.

Co-authored-by: bjohansebas <[email protected]>
2026-07-05 21:30:48 -05:00
9897eded61 fix: detect secure socket when connection is missing (#1124)
* fix: detect secure socket when connection is missing

* fix: improve secure socket detection logic in session handling

---------

Co-authored-by: Sebastian Beltran <[email protected]>
2026-07-05 21:24:05 -05:00
672216dd12 fix: use RFC 6265 path matching for cookie path option (#1114)
* test: add specific RFC 6265 5.1.4 compliance tests

* feat: add specific RFC 6265 5.1.4 handler

* docs: note RFC 6265 5.1.4 compliance in cookie.path documentation

* feat: enhance cookie handling for RFC 6265 compliance with path matching and auto secure/sameSite options

* feat: enforce RFC 6265 section 5.1.4 path matching for session cookie path

---------

Co-authored-by: Sebastian Beltran <[email protected]>
2026-07-05 21:07:01 -05:00
00819ea8b5 feat: add support to dynamic cookie options (#1027)
Co-authored-by: Sebastian Beltran <[email protected]>
Co-authored-by: Ulises Gascón <[email protected]>
2026-01-19 15:44:13 +01:00
b1bd2fda4e Add sameSite 'auto' support to match secure 'auto' pattern (#1087)
* feat: add sameSite 'auto' support for automatic cross-site cookie configuration

* test: enhance session tests for secure and SameSite cookie attributes

* test: update session tests for SameSite cookie handling and logging

* docs: add history entry

* refactor: cache issecure result to avoid duplicate calls

* Apply suggestion from @bjohansebas

---------

Co-authored-by: Sebastian Beltran <[email protected]>
2026-01-17 17:20:37 -05:00
Noritaka KobayashiandGitHub 0e309c03b6 chore: fix typos (#1066) 2025-07-11 12:21:20 -05:00
ctcpip 0483250f7b ✅ always generate fresh cert 2025-01-23 12:45:47 -06:00
Wes ToddandChris de Almeida c16b387cad feat: gencert script to regenerate the test ssl certs 2025-01-23 12:45:47 -06:00
ctcpip 927eb0a3d1 🔒️ use 2048 bit key
cd test/fixtures

openssl genpkey -algorithm RSA -out new_server.key -pkeyopt rsa_keygen_bits:2048

openssl x509 -in server.crt -signkey new_server.key -days 3650 -out new_server.crt

openssl x509 -in new_server.crt -text -noout

mv new_server.crt server.crt

mv new_server.key server.key
2025-01-22 09:21:49 -06:00
BaileyFirmanandChris de Almeida ac03912090 Refresh server.crt with existing key extending expiry to Nov 21 03:28:10 2024 GMT 2025-01-22 09:21:49 -06:00
Alex OpandDouglas Christopher Wilson 408229ea33 Add "partitioned" to cookie options
fixes #961
closes #966
2024-01-28 15:24:39 -05:00
Douglas Christopher Wilson d9354ef09f Fix handling errors from setting cookie 2024-01-28 14:44:24 -05:00
Marc UdoffandDouglas Christopher Wilson 3ee08c466c Add "priority" to cookie options
closes #884
closes #939
2024-01-28 14:17:19 -05:00
Douglas Christopher Wilson d8a8fe23e7 Support any type in "secret" that crypto.createHmac supports 2023-06-08 23:02:49 -04:00
Jeremy NeanderandDouglas Christopher Wilson 99d6cdea3e Fix resaving already-saved new session at end of request
closes #849
2022-05-11 12:39:41 -04:00
Michaël ZassoandDouglas Christopher Wilson 2f6cc21a23 build: [email protected]
closes #844
2021-12-23 21:55:13 -05:00
Douglas Christopher Wilson 9a1cc15efb build: [email protected] 2021-05-19 08:10:33 -04:00
Douglas Christopher Wilson c5cd790563 tests: add helper for delay store set 2020-09-03 20:43:27 -04:00
Douglas Christopher Wilson 6a128cc594 Fix res.end patch to always commit headers
fixes #766
closes #767
2020-07-08 22:49:25 -04:00
Glenn HinksandDouglas Christopher Wilson 7d7f4f72dd tests: add res.writeHead set-cookie test
closes #746
2020-07-06 21:11:56 -04:00
Glenn HinksandDouglas Christopher Wilson 3b08fc7a78 tests: fix test validation of session ID
closes #742
2020-04-17 12:04:21 -04:00
Glenn HinksandDouglas Christopher Wilson 975924658f tests: remove duplicate test
closes #741
2020-04-17 11:27:29 -04:00
Gaby BaghdadiandDouglas Christopher Wilson 4b40b2fb54 tests: fix flaky cookie.maxAge test
closes #713
2020-04-16 21:03:50 -04:00
Douglas Christopher Wilson 5d5b51ff22 tests: resolve originalMaxAge flaky tests
fixes #719
2020-04-16 20:48:21 -04:00
ZirakandDouglas Christopher Wilson ac3f0a256b Fix internal method wrapping error on failed reloads
closes #715
2020-04-16 20:31:08 -04:00
Janusz BiałobrzewskiandDouglas Christopher Wilson 30e23f1343 Fix restoring cookie.originalMaxAge when store returns Date
fixes #664
2019-06-12 00:54:22 -04:00
Douglas Christopher Wilson 479940afd2 tests: add cookie.originalMaxAge tests 2019-06-12 00:07:59 -04:00
geekjob-ruandDouglas Christopher Wilson 85682a2a56 Fix uncaught error from bad session data
closes #634
2019-04-11 11:43:05 -04:00
eol95andDouglas Christopher Wilson 1e3fc39a3f Fix error passing "data" option to Cookie constructor
fixes #648
closes #649
2019-04-11 10:21:22 -04:00
Douglas Christopher Wilson 3e0d5489f5 tests: move some code into support/ 2019-03-02 13:09:20 -05:00
Paul BergandDouglas Christopher Wilson 784d7434da Catch invalid cookie.maxAge value earlier
closes #432
closes #574
2018-11-20 14:32:44 -05:00
Douglas Christopher Wilson 2cf079688a tests: add tests for Date as maxAge 2018-11-05 13:27:09 -05:00
Douglas Christopher Wilson 19b4f4ed41 tests: reorganize new Cookie options tests 2018-11-05 13:14:30 -05:00
Douglas Christopher Wilson 868c5fb9ad tests: add maxAge to new Cookie tests 2018-11-05 13:09:27 -05:00
Douglas Christopher Wilson bcad89859f Fix issue where "resave: false" may not save altered sessions 2018-09-24 22:18:56 -04:00
Douglas Christopher Wilson a6402811c1 tests: add describe level in "resave option" tests 2018-09-24 14:13:14 -04:00
Douglas Christopher Wilson 785d094705 tests: use strict equality 2018-09-24 10:23:33 -04:00
Douglas Christopher Wilson 104725ebcb tests: add missing tests for "name" option 2018-04-01 14:33:45 -04:00
Douglas Christopher Wilson befa6b5c88 tests: add additional supertest helper 2018-03-14 16:17:13 -04:00
VoidandDouglas Christopher Wilson efdde800ef Add type check to new Cookie(options)
closes #544
2018-03-14 15:29:40 -04:00
Douglas Christopher Wilson 082e56effc tests: add basic tests for Cookie object 2018-03-14 15:26:04 -04:00
Douglas Christopher Wilson 2bb2860794 lint: only declare one variable per var 2018-01-07 22:09:36 -05:00
Douglas Christopher Wilson 8b4f668dba lint: add editorconfig and eslint to enforce 2017-08-27 22:08:20 -04:00
Douglas Christopher Wilson c22630155f Fix TypeError when req.url is an empty string
fixes #495
2017-08-02 22:33:19 -04:00
Douglas Christopher Wilson 62c4d15c71 tests: add test for mounted middleware 2017-08-02 21:48:45 -04:00
Douglas Christopher Wilson 8518200db4 tests: move the cookie path tests 2017-08-02 21:11:11 -04:00
Douglas Christopher Wilson 4a4c2efa19 tests: remove express from more tests 2017-03-10 21:28:53 -05:00
Douglas Christopher Wilson 66e518be96 tests: fix req.secret test 2017-03-10 20:58:03 -05:00
Douglas Christopher Wilson 28d5332c9d tests: improve accuracy of maxAge cookie tests 2017-01-22 21:18:34 -05:00
Douglas Christopher Wilson 42007efe95 tests: add helpers to validate set-cookie attributes 2017-01-22 18:49:19 -05:00