feat: add disabledCipherSuites option to setSSLConfig (#25818)

This commit is contained in:
Jeremy Rose 2020-10-21 11:03:59 -07:00 committed by GitHub
parent f6a27973d1
commit 22cb3cd18b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 85 additions and 4 deletions

View file

@ -202,6 +202,19 @@ bool SSLProtocolVersionFromString(const std::string& version_str,
return false;
}
template <>
struct Converter<uint16_t> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
uint16_t* out) {
auto maybe = val->IntegerValue(isolate->GetCurrentContext());
if (maybe.IsNothing())
return false;
*out = maybe.FromJust();
return true;
}
};
template <>
struct Converter<network::mojom::SSLConfigPtr> {
static bool FromV8(v8::Isolate* isolate,
@ -224,8 +237,14 @@ struct Converter<network::mojom::SSLConfigPtr> {
return false;
}
// TODO(nornagon): also support client_cert_pooling_policy and
// disabled_cipher_suites. Maybe other SSLConfig properties too?
if (options.Has("disabledCipherSuites") &&
!options.Get("disabledCipherSuites", &(*out)->disabled_cipher_suites)) {
return false;
}
std::sort((*out)->disabled_cipher_suites.begin(),
(*out)->disabled_cipher_suites.end());
// TODO(nornagon): also support other SSLConfig properties?
return true;
}
};