Repository navigation
feat: emit select-client-certificate for net module requests - #52397
Merged
jkleinsc merged 13 commits intoJul 23, 2026
Conversation
net.request and net.fetch requests to servers that send a TLS CertificateRequest currently abort with ERR_SSL_CLIENT_AUTH_CERT_NEEDED because SimpleURLLoaderWrapper::OnCertificateRequested and URLLoaderNetworkObserver::OnCertificateRequested are empty stubs; dropping the ClientCertificateResponder pipe causes the network service to cancel the request. The select-client-certificate event only fired for BrowserWindow page loads. Implement OnCertificateRequested for both observers by fetching client identities via ElectronBrowserClient::CreateClientCertStore() and routing through the existing ElectronBrowserClient::SelectClientCertificate path with web_contents = nullptr. When no matching identities exist the request continues without a certificate, so optional client-certificate endpoints work without any app-side handler. Closes #29984. Notes: Added `select-client-certificate` event support for `net.request` and `net.fetch`; requests to servers with optional client-certificate authentication no longer fail with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. Co-authored-by: Danny Cochran <[email protected]>
… event Co-authored-by: Danny Cochran <[email protected]>
…odule Co-authored-by: Danny Cochran <[email protected]>
ClientCertificateResponderDelegate calls these on ElectronBrowserClient directly to route net-module client certificate requests through the existing app 'select-client-certificate' event path. Co-authored-by: Danny Cochran <[email protected]>
OnClientCertificateSelected dereferenced an empty v8::Local when the JS callback was invoked with no arguments: args->GetNext() returned false and val stayed empty, then val->IsNull() crashed. The documentation for select-client-certificate says callback() with no certificate continues without one, so this must work. Guard for no-argument / empty / null / undefined in one place. This is pre-existing code shared with the BrowserWindow path, so this also fixes the same crash for the existing app 'select-client-certificate' event when callback() is called with no argument. Co-authored-by: Danny Cochran <[email protected]>
…ener Shorten the helper-class comments in client_certificate_responder_delegate and ensure the select-client-certificate handler in api-net-spec is removed even when the event does not fire (the empty-identity short-circuit), so it cannot leak onto the global app object across spec files. Co-authored-by: Danny Cochran <[email protected]>
Mirror content/browser/ssl_private_key_impl.cc and wrap the mojo SignCallback with WrapCallbackWithDefaultInvokeIfNotRun so a platform key store that abandons its sign callback (https://crbug.com/40651689) fails the client-auth handshake with ERR_FAILED instead of leaving the net.fetch / net.request / utility-process request hung. Co-authored-by: Danny Cochran <[email protected]>
Extend the select-client-certificate breaking-changes entry to call out that net.request / net.fetch now default to the first matching platform client certificate (previously ERR_SSL_CLIENT_AUTH_CERT_NEEDED), and how to opt out. Co-authored-by: Danny Cochran <[email protected]>
…tity When a 'select-client-certificate' listener invokes the callback synchronously without calling event.preventDefault(), the matched ClientCertIdentity is std::moved out of shared_identities inside OnClientCertificateSelected. The fall-through default-selection block then dereferences (*shared_identities)[0], which is now a moved-from unique_ptr. Guard for it. Co-authored-by: Danny Cochran <[email protected]>
Co-authored-by: Danny Cochran <[email protected]>
Co-authored-by: Danny Cochran <[email protected]>
Co-authored-by: Danny Cochran <[email protected]>
Co-authored-by: Danny Cochran <[email protected]>
6 of 7 tasks
Member
|
@electron/wg-releases approved this for backport. |
jkleinsc
approved these changes
Jul 23, 2026
|
Release Notes Persisted
|
jkleinsc
deleted the
trop/44-x-y-bp-feat-emit-select-client-certificate-for-net-module-requests-1784560328477
branch
July 23, 2026 19:46
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport of #52162
See that PR for details.
Notes: Added
select-client-certificateevent support fornet.requestandnet.fetch; requests to servers requesting a client certificate no longer fail withERR_SSL_CLIENT_AUTH_CERT_NEEDED, and applications can now select a certificate to present.