chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.38k stars 467 forks source link

OnCertificateError are not fired on inner resources #3732

Closed Speed7811 closed 4 months ago

Speed7811 commented 4 months ago

Describe the bug Event "OnCertificateError" is not fired on inner resources.

I used the Cefsharp browser and a developer said that he cannot fix it. It must be fixed in the lib directly.

To Reproduce Steps to reproduce the behavior:

  1. Clear ChromiumWebBrowser cache (directory)
  2. Use a website which contains a Javascript. This Javascript executes a"fetch"-Method to an URL with a self signed certificate (e.g. https://self-signed.badssl.com/)
  3. Create a new ChromiumWebBrowser instance and set as RequestHandler a handler which overrides "OnCertificateError". In "OnCertificateError" accept any certificate.
  4. Load the website

Expected behavior "OnCertificateError" should be fired when the javascript fetch will be executed.

Versions (please complete the following information):

Additional context If I set in the global settings of Cefsharp "IgnoreCertificateErrors" to true it works. The problem is I cannot use it because I have in the same process two browser instances. I need the certificate ignore flag only on one instance or for one url. Maybe somebody knows a setting for doing this.

In the past there was an IgnoreCertificateError on the RequestContext but this was removed.

A developer of CefSharp gave me the following url to the necessary code: https://github.com/chromiumembedded/cef/blob/231701d98b1427a41a75098bd6bd3bd803f9dacc/libcef/browser/certificate_query.cc#L93

Does the problem reproduce with Google Chrome at the same version? In Google Chome I can make an certificate exception for the website and it works for the javascript.

magreenblatt commented 4 months ago

"OnCertificateError" should be fired when the javascript fetch will be executed.

OnCertificateError is only called for navigations.

In Google Chome I can make an certificate exception for the website and it works for the javascript.

The same settings are available in CEF Chrome runtime.