This repository was archived by the owner on Apr 22, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
tls: Update cipher-list defaults, add command-line switches #14383
Closed
jasnell
wants to merge
5
commits into
nodejs:master
from
jasnell:tls-update-cipher-suite-with-switches
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1b1fe53
tls: more secure defaults
jasnell 12c3a57
tls: command-line switch and envar cipher-list override
jasnell 9329464
tls: make --enable-legacy-cipher-list less verbose
jasnell 09160f5
tls: pass in isolate with define string constant + style nits
jasnell a9f8196
test: fixing a few nits in the test
jasnell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,7 @@ namespace node { | |
|
||
bool SSL2_ENABLE = false; | ||
bool SSL3_ENABLE = false; | ||
const char * DEFAULT_CIPHER_LIST = DEFAULT_CIPHER_LIST_HEAD; | ||
|
||
namespace crypto { | ||
|
||
|
@@ -4851,6 +4852,26 @@ static void array_push_back(const TypeName* md, | |
ctx->arr->Set(ctx->arr->Length(), OneByteString(ctx->env()->isolate(), from)); | ||
} | ||
|
||
// borrowed from v8 | ||
// (see http://v8.googlecode.com/svn/trunk/samples/shell.cc) | ||
const char* ToCString(const String::Utf8Value& value) { | ||
return *value ? *value : "<string conversion failed>"; | ||
} | ||
|
||
void DefaultCiphers(const v8::FunctionCallbackInfo<v8::Value>& args) { | ||
Environment* env = Environment::GetCurrent(args.GetIsolate()); | ||
HandleScope scope(env->isolate()); | ||
v8::String::Utf8Value key(args[0]); | ||
const char * list = legacy_cipher_list(ToCString(key)); | ||
if (list != NULL) { | ||
args.GetReturnValue().Set( | ||
v8::String::NewFromUtf8(args.GetIsolate(), list)); | ||
} else { | ||
args.GetReturnValue().Set( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should a warning be displayed if a given legacy ciphers identifier doesn't exist? |
||
v8::String::NewFromUtf8(args.GetIsolate(), | ||
DEFAULT_CIPHER_LIST_HEAD)); | ||
} | ||
} | ||
|
||
void GetCiphers(const FunctionCallbackInfo<Value>& args) { | ||
Environment* env = Environment::GetCurrent(args.GetIsolate()); | ||
|
@@ -5171,6 +5192,9 @@ void InitCrypto(Handle<Object> target, | |
|
||
NODE_DEFINE_CONSTANT(target, SSL3_ENABLE); | ||
NODE_DEFINE_CONSTANT(target, SSL2_ENABLE); | ||
|
||
NODE_DEFINE_STRING_CONSTANT(env->isolate(), target, DEFAULT_CIPHER_LIST); | ||
NODE_SET_METHOD(target, "getLegacyCiphers", DefaultCiphers); | ||
} | ||
|
||
} // namespace crypto | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be done in
src/node.js
instead of insrc/node.cc
? It seems it would just be less error prone and shorter.