-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
process,tls: stop relying on process.features #21087
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
Conversation
The `process.features` property is mutable by userland such that `delete process.features` will cause SNI and ALPN support for fail. Add the necessary properties to `process.config('binding')` so that we are not relying on a user-modifiable object. Also clean up the `GetFeatures` funciton just a bit.
src/node.cc
Outdated
#else | ||
Local<Boolean> tls_ocsp = False(env->isolate()); | ||
Local<Boolean> tls_ocsp = falseValue; |
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.
style nit: true_value
and false_value
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.
lgtm with addaleax's nit fixed
EscapableHandleScope scope(env->isolate()); | ||
Isolate* isolate = env->isolate(); | ||
EscapableHandleScope scope(isolate); | ||
Local<Boolean> true_value = True(isolate); |
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.
Why do we need these two separate variables instead of using True(isolate)
and False(isolate)
inline like before?
#else | ||
Local<Value> debug = False(env->isolate()); | ||
Local<Boolean> debug = false_value; |
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.
Instead of making this change multiple times, what if we instead removed the temporary variables instead and just set the values directly in the obj->Set()
calls? For example:
obj->Set(FIXED_ONE_BYTE_STRING(isolate, "debug"),
#if defined(DEBUG) && DEBUG
True(isolate)
#else
False(isolate)
#endif
);
or something similar or maybe even write a macro for this?
In the words of the great poet Zappa: I've got a better idea! See #21094, we can get rid of the conditionals altogether, they're remnants from when we supported older versions of openssl. |
Even better. |
Closing in favor of #21094! |
The
process.features
property is mutable by userland such thatdelete process.features
will cause SNI and ALPN support for fail.Add the necessary properties to
process.config('binding')
so thatwe are not relying on a user-modifiable object.
Also clean up the
GetFeatures
funciton just a bit.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes