Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tls: accept SecureContext object in server.addContext() #47570

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

HinataKah0
Copy link
Contributor

Do not call tls.createSecureContext() if the context provided is already an instance of tls.SecureContext.

Fixes: #47408

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem. labels Apr 15, 2023
@anonrig anonrig added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 15, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 15, 2023
@nodejs-github-bot
Copy link
Collaborator

@HinataKah0
Copy link
Contributor Author

Failing test: tools/test.py test/parallel/test-child-process-exec-stdout-stderr-data-string.js

It looks like a flaky test (doesn't seem to be related to the PR and tried running locally)
Shall we re-run?

test/parallel/test-tls-add-context.js Outdated Show resolved Hide resolved
Do not call tls.createSecureContext() if the context provided
is already an instance of tls.SecureContext.

Fixes: nodejs#47408
[re, tls.createSecureContext(context).context]);

const secureContext =
context instanceof common.SecureContext ? context : tls.createSecureContext(context);
Copy link
Member

Choose a reason for hiding this comment

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

Might be worth implementing a more efficient isSecureContext(...) method under util/types

Copy link
Contributor Author

@HinataKah0 HinataKah0 Apr 18, 2023

Choose a reason for hiding this comment

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

I don't think this function is in hot path (there are limited number of subdomains & certs), so might not be worth the perf improvement vs code growth in primordials. Not too sure, CMIIW.

@HinataKah0
Copy link
Contributor Author

BTW, I can't add the labels myself. So I can't add request-ci and other labels necessary to have it merged. :)

@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 23, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 23, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@lpinca lpinca added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 26, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 26, 2023
@nodejs-github-bot nodejs-github-bot merged commit b54504c into nodejs:main Apr 26, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in b54504c

yjl9903 pushed a commit to yjl9903/node that referenced this pull request Apr 28, 2023
Do not call tls.createSecureContext() if the context provided
is already an instance of tls.SecureContext.

Fixes: nodejs#47408
PR-URL: nodejs#47570
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
yjl9903 pushed a commit to yjl9903/node that referenced this pull request Apr 28, 2023
Do not call tls.createSecureContext() if the context provided
is already an instance of tls.SecureContext.

Fixes: nodejs#47408
PR-URL: nodejs#47570
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
yjl9903 pushed a commit to yjl9903/node that referenced this pull request Apr 29, 2023
Do not call tls.createSecureContext() if the context provided
is already an instance of tls.SecureContext.

Fixes: nodejs#47408
PR-URL: nodejs#47570
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request May 2, 2023
Do not call tls.createSecureContext() if the context provided
is already an instance of tls.SecureContext.

Fixes: #47408
PR-URL: #47570
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targos targos mentioned this pull request May 2, 2023
@HinataKah0 HinataKah0 deleted the tls-secure-context branch May 14, 2023 09:33
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
Do not call tls.createSecureContext() if the context provided
is already an instance of tls.SecureContext.

Fixes: #47408
PR-URL: #47570
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MoLow pushed a commit to MoLow/node that referenced this pull request Jul 6, 2023
Do not call tls.createSecureContext() if the context provided
is already an instance of tls.SecureContext.

Fixes: nodejs#47408
PR-URL: nodejs#47570
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. tls Issues and PRs related to the tls subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tls.SecureContext documentation contradictions
7 participants