Repository navigation
Conversation
|
💖 Thanks for opening this pull request! 💖 Semantic PR titlesWe use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Commit signingThis repo enforces commit signatures for all incoming PRs. PR tipsThings that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
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 electron#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.
ClientCertificateResponderDelegate calls these on ElectronBrowserClient directly to route net-module client certificate requests through the existing app 'select-client-certificate' event path.
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.
…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.
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.
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.
…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.
b4d5314 to
480064a
Compare
|
Congrats on merging your first pull request! 🎉🎉🎉 |
|
Release Notes Persisted
|
|
I was unable to backport this PR to "42-x-y" cleanly; |
|
I have automatically backported this PR to "44-x-y", please check out #52397 |
|
I have automatically backported this PR to "43-x-y", please check out #52398 |
Description of Change
Companion to #52160 (the minimal decline-only fix). This is the full implementation that also wires the
select-client-certificateevent fornet.request/net.fetch/ utility-process requests, so applications can choose a client certificate rather than always declining.SimpleURLLoaderWrapper::OnCertificateRequestedandURLLoaderNetworkObserver::OnCertificateRequestedare implemented to fetch client identities viaElectronBrowserClient::CreateClientCertStore()and route through the existingApp::SelectClientCertificatepath withwebContentsasnull(matching the existingapp'login'event behavior fornetmodule requests). When no matching identities exist, the request proceeds without a certificate. A sharedClientCertificateResponderDelegateadapter bridgesnetwork::mojom::ClientCertificateResponder↔content::ClientCertificateDelegate, and anSSLPrivateKeyImpl(mirroringcontent::SSLPrivateKeyImpl) handles the key wrapping.Refs #29984.
Posting both this and #52160 as drafts so reviewers can compare the minimal fix vs. the full event wiring; happy to consolidate to whichever direction is preferred (or to a
session.setClientCertificateSelectHandler()shape if that's a better fit — see #29984 discussion).Checklist
npm testpassesRelease Notes
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.