-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Make --use-system-ca per-env rather than per-process #60678
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
base: main
Are you sure you want to change the base?
Conversation
|
Review requested:
|
d87558c to
23473b9
Compare
|
Hmm, I think this may need more work than just updating the options - the implication of being per-env is that each worker would then be able to toggle this independently. Say when the main thread does not enable it but a worker does, then the worker will have the system CA certs in their default store but the parent doesn't. Can you add a test for this, and the other way around (parent enables it, worker disables it)? My impression is that the default store initialisation code is not yet ready for this and it's still shared across the process (so if a worker enables it, suddenly the parent get it too, which would be unexpected). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60678 +/- ##
==========================================
- Coverage 88.54% 88.51% -0.03%
==========================================
Files 704 704
Lines 208793 208815 +22
Branches 40307 40315 +8
==========================================
- Hits 184866 184835 -31
- Misses 15913 15957 +44
- Partials 8014 8023 +9
🚀 New features to boost your workflow:
|
f22457c to
780c272
Compare
38913f9 to
d9fb49d
Compare
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.
Can you add some tests to test/parallel that checks this affects tls.getCACertificates('default') in a worker if tls.getCACertificates('system') returns non-empty in a parent? (if there are no system CAs in the testing machine, then the test can be skipped - that way it can run even without the mock certificates installed)
src/crypto/crypto_context.cc
Outdated
| static std::atomic<bool> has_cached_bundled_root_certs{false}; | ||
| static std::atomic<bool> has_cached_system_root_certs{false}; | ||
| static std::atomic<bool> has_cached_extra_root_certs{false}; | ||
| static std::atomic<bool> has_use_system_ca{false}; |
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.
I think it might be worth it to tweak StartLoadingCertificatesOffThread so that if no thread has started loading system CAs off thread, and a new worker is run with --use-system-ca, then the new worker can still trigger an off-thread load (right now I think it only try once, and if the first try does not include system CA then there won't be any off-thread loading anymore). Although, this can just be a TODO and doesn't need to be addressed here.
|
|
||
| // TODO(joyeecheung): we can probably just reset it to nullptr | ||
| // and let the next call to NewRootCertStore() create a new one. | ||
| root_cert_store = NewRootCertStore(); |
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.
Can you remove the TODO comment above? :)
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.
Oops! 🤦♀️
d9fb49d to
77856be
Compare
77856be to
d8281c4
Compare
Makes the
--use-system-caoption a per-environment option rather than a per-process option so that workers can enable/disable them individually