process,tls: stop relying on process.features#21087
process,tls: stop relying on process.features#21087jasnell wants to merge 2 commits intonodejs:masterfrom
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
| Local<Boolean> tls_ocsp = trueValue; | ||
| #else | ||
| Local<Boolean> tls_ocsp = False(env->isolate()); | ||
| Local<Boolean> tls_ocsp = falseValue; |
There was a problem hiding this comment.
style nit: true_value and false_value
devsnek
left a comment
There was a problem hiding this comment.
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.
Why do we need these two separate variables instead of using True(isolate) and False(isolate) inline like before?
| Local<Boolean> debug = true_value; | ||
| #else | ||
| Local<Value> debug = False(env->isolate()); | ||
| Local<Boolean> debug = false_value; |
There was a problem hiding this comment.
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.featuresproperty is mutable by userland such thatdelete process.featureswill 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
GetFeaturesfunciton just a bit.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes