tls: make Server.getTicketKeys throw instead of assert#58365
Conversation
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #58365 +/- ##
==========================================
- Coverage 90.23% 90.22% -0.01%
==========================================
Files 739 739
Lines 241639 241640 +1
Branches 45547 45535 -12
==========================================
- Hits 218031 218030 -1
- Misses 15152 15153 +1
- Partials 8456 8457 +1
🚀 New features to boost your workflow:
|
|
The linter pipeline section seems to be broken. |
|
anything i need to do on my end? |
19a54a8 to
b2dd7ec
Compare
joyeecheung
left a comment
There was a problem hiding this comment.
The PR is updatingServer.setTicketKeys but the commit message talks about Server.getTicketKeys instead. Can you update the commit message?
| assert(keys.byteLength === 48, | ||
| 'Session ticket keys must be a 48-byte buffer'); | ||
| if (keys.byteLength !== 48) { | ||
| throw new ERR_INVALID_ARG_VALUE('keys', keys.byteLength, 'must be exactly 48 bytes'); |
There was a problem hiding this comment.
| throw new ERR_INVALID_ARG_VALUE('keys', keys.byteLength, 'must be exactly 48 bytes'); | |
| throw new ERR_INVALID_ARG_VALUE('keys.byteLength', keys.byteLength, 'must be 48 bytes'); |
The original message looks a bit ambiguous to me by saying "received N" (but N=buffer.byteLength isn't the argument. The buffer is).
|
|
||
|
|
||
| Server.prototype.setTicketKeys = function setTicketKeys(keys) { | ||
| validateBuffer(keys); |
There was a problem hiding this comment.
| validateBuffer(keys); | |
| validateBuffer(keys, 'keys'); |
This predated the PR but since it's adding a test for the message, let's align the two names.
| { | ||
| name: 'TypeError', | ||
| code: 'ERR_INVALID_ARG_TYPE', | ||
| message: 'The "buffer" argument must be an instance of Buffer, TypedArray, or DataView.' + |
There was a problem hiding this comment.
| message: 'The "buffer" argument must be an instance of Buffer, TypedArray, or DataView.' + | |
| message: 'The "keys" argument must be an instance of Buffer, TypedArray, or DataView.' + |
| { | ||
| name: 'TypeError', | ||
| code: 'ERR_INVALID_ARG_VALUE', | ||
| message: `The argument 'keys' must be exactly 48 bytes. Received ${arg.byteLength}`, |
There was a problem hiding this comment.
| message: `The argument 'keys' must be exactly 48 bytes. Received ${arg.byteLength}`, | |
| message: `The property 'keys.byteLength' must be exactly 48 bytes. Received ${arg.byteLength}`, |
|
This pull request has been marked as stale due to 210 days of inactivity. |
|
Hello, I'm doing some backlog hygiene on all PRs related to networking and streaming modules. There hasn't been any activity here for quite a while so I'm going to mark it Thank you! |
|
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
b2dd7ec to
48174e6
Compare
assert is for invariants and print a message about the condition being a bug in Node.js if false. throw ERR_INVALID_ARG_VALUE for publicly facing validation. Signed-off-by: Meghan Denny <hello@nektro.net>
48174e6 to
43a4f4e
Compare
assert is for invariants and prints a message about the condition being a bug in Node.js if false.
throw ERR_INVALID_ARG_VALUE for publicly facing validation.
this brings it into sync with the validation done in configSecureContext.