FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

tls: add getter and setter for session ticket number. by mkrawczuk · Pull Request #34020 · nodejs/node · GitHub

/ node Public

tls: add getter and setter for session ticket number. - #34020

Closed
mkrawczuk wants to merge 2 commits into
nodejs:mainfrom
mkrawczuk:tls_numTicketsGetSet
Closed

tls: add getter and setter for session ticket number.#34020
mkrawczuk wants to merge 2 commits into
nodejs:mainfrom
mkrawczuk:tls_numTicketsGetSet

Conversation

Copy link
Copy Markdown
Contributor

This is a TLS API extension enabling to control the number of session tickets that server sends to the client. Usually it is 2, but sometime it makes sens to set it to 1, or even 0.

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. labels Jun 22, 2020
addaleax added semver-minor PRs that contain new features and should be released in the next minor version. tls Issues and PRs related to the tls subsystem. and removed lib / src Issues and PRs involving general changes in the lib/ or src/ directories. labels Jun 22, 2020

addaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@nodejs/crypto

Comment thread src/node_crypto.cc Outdated

mildsunrise left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, thanks!

Comment thread lib/_tls_wrap.js
Co-authored-by: Anna Henningsen <github@addaleax.net>

bnoordhuis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm missing two things from the documentation:

  1. Why you would want to change the default. (I'm aware openssl lets you but besides compliance testing I have no idea why you would.)

  2. No mention that the setting only applies to the initial handshake. For resumption, it's fixed at 1.

Comment thread src/node_crypto.cc
Comment on lines +1583 to +1585
uint32_t numTickets = args[0].As<Uint32>()->Value();

CHECK(SSL_CTX_set_num_tickets(sc->ctx_.get(), numTickets));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
uint32_t numTickets = args[0].As<Uint32>()->Value();
CHECK(SSL_CTX_set_num_tickets(sc->ctx_.get(), numTickets));
uint32_t num_tickets = args[0].As<Uint32>()->Value();
CHECK_EQ(1, SSL_CTX_set_num_tickets(sc->ctx_.get(), num_tickets));

Comment thread lib/_tls_common.js
options.clientCertEngine);
}

if (options.numTickets) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This won't let you set it to 0.

Comment thread lib/_tls_wrap.js
}

if (options.numTickets)
this.numTickets = options.numTickets;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ditto, plus it introduces a performance gotcha in that it creates two hidden classes: one with the property, one without. Always set the property.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hey @bnoordhuis could you please clarify how it creates two hidden classes: one with the property, one without?

});

const expectedNumTickets = 1;
// 2 is the deafult value set by OpenSSL.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
// 2 is the deafult value set by OpenSSL.
// 2 is the default value set by OpenSSL.

code: 'ERR_INVALID_ARG_TYPE',
message: 'Number of tickets must be an unsigned 32-bit integer'
}
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you check multiple values, e.g.:

for (const expectedNumTickets of [0, 1, 2, 42, 1337, 2 ** 32 - 1]) {
  // ...
}

Checking that 2 ** 32 throws would be good, too.

Comment thread lib/_tls_wrap.js

Server.prototype.getNumTickets = function getNumTickets() {
return this._sharedCreds.context.getNumTickets();
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

hmm.. I thought I had left a review comment on this previously but I'm not seeing it now... Stylistically, I'd much prefer these to get regular getter/setters (e.g. server.numTickets = 1) rather than separate functions like this.

PoojaDurgad commented Dec 24, 2020
edited
Loading

Copy link
Copy Markdown
Contributor

@mkrawczuk - This PR seems to have gotten a little stuck and this requires rebase due to git conflicts.

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

Closing this because it has stalled. Feel free to reopen if this issue/PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions.

github-actions Bot closed this Jun 12, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. semver-minor PRs that contain new features and should be released in the next minor version. stalled Issues and PRs manually marked as stalled and scheduled for automatic closure. tls Issues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL