Skip to content
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

Add option to accept self-signed certificates #211

Open
adambarreiro opened this issue Sep 25, 2023 · 26 comments
Open

Add option to accept self-signed certificates #211

adambarreiro opened this issue Sep 25, 2023 · 26 comments

Comments

@adambarreiro
Copy link

Hi,

First of all, thanks for creating and developing Bruno!
I started to migrate my Postman collections to Bruno, and I'm facing the following error when running requests:

Error invoking remote method 'send-http-request': Error: self signed certificate in certificate chain

The target server is indeed using self-signed certificates, as it is a development server used for testing.
Would it be possible to add an option to ignore this case?

I could do a tiny workaround in macOS using the terminal:

NODE_TLS_REJECT_UNAUTHORIZED='0' /Applications/Bruno.app/Contents/MacOS/Bruno

Thanks in advance!

@adambarreiro
Copy link
Author

I just found the option in the UI. Apologies for the noise!

@helloanoop
Copy link
Contributor

No worries :)

@piyh
Copy link

piyh commented Oct 2, 2023

For all those finding this through search, the option is on settings off the gear icon on the bottom left, not the top right.

@ebricca
Copy link

ebricca commented Oct 20, 2023

for those that got a preference save error

one has to set the proxy.port to a number e.g. 1000 even when not used

( output from devtools :)
Error: Error invoking remote method 'renderer:save-preferences': ValidationError: proxy.port must be a number type, but the final value was: NaN (cast from the value ""). )

@Schm1tz1
Copy link

Schm1tz1 commented Oct 25, 2023

Hi all, seems like I'm running into the same issue. I am using a self-signed cert with my own custom CA. Deactivating SSL Certificate Validation does not work even after restart of Bruno - I am still getting Error invoking remote method 'send-http-request': Error: self signed certificate in certificate chain. Setting the env-var as @adambarreiro mentioned works for me.
I'm using Bruno 0.27.2 on macOS 13.6

@helloanoop helloanoop reopened this Oct 25, 2023
@geraintwjones
Copy link

geraintwjones commented Oct 30, 2023

I'm getting Error: socket hang up now. Works fine with Insomnia, so I know the server's responding. Must be something I've not done, or have done incorrectly in Bruno.

I tried setting request timeout to 1000ms, no response. Insomnia gets a response in 560ms.

Screenshot 2023-10-30 at 16 43 49

@Shackelford-Arden
Copy link

I'm in the same boat as @Schm1tz1 :

  • I've disabled SSL Verification
  • I've opened Bruno w/ the same environment variable (NODE_TLS_REJECT_UNAUTHORIZED=0)

I'm on Bruno 1.3.0 MacOS 14.1.2

@BrandonGillis
Copy link
Contributor

Hello @Shackelford-Arden and @geraintwjones , could you please try again on Bruno 1.3.2, as it include fixes related to localhost environment if you was having the SSL issue on localhost

@geraintwjones
Copy link

I'm getting Error invoking remote method 'send-http-request': Error: socket hang up.

@geraintwjones
Copy link

Screenshot 2023-12-04 at 20 50 43

@geraintwjones
Copy link

Screenshot 2023-12-04 at 20 56 16

It's really annoying that I can't see what's in that client certificate.

@Shackelford-Arden
Copy link

@BrandonGillis having updated to 1.3.2, I still need to set the environment variable when opening Bruno to make calls against self-signed certs w/ validation turned off.

Just for clarity, here is the SSL/TLS Cerficiate Verification turned off:

image

Error when attempting to make call against self-signed resource:

image

Same settings but running Bruno like this:

NODE_TLS_REJECT_UNAUTHORIZED='0' /Applications/Bruno.app/Contents/MacOS/Bruno

Gets the response I expected.

@geraintwjones
Copy link

@Shackelford-Arden I tried that. I get the same error as before. Also, by starting Bruno like this...

NODE_TLS_REJECT_UNAUTHORIZED='0' /Applications/Bruno.app/Contents/MacOS/Bruno

I get the following output...

bruno-log.txt

@helloanoop
Copy link
Contributor

helloanoop commented Jan 4, 2024

Support for specifying Custom CA is now available in v1.6.0 🎉 🎉
Thank you @BrandonGillis for working on this (pr: #1155)

@Shackelford-Arden @Schm1tz1 @geraintwjones The release also involves fixes for the issue you were facing. Can you download 1.6.0 and see if it solves your issue ?

@ivycristina
Copy link

I downloaded version 1.6.0 and I'm getting this error, can anyone help me?
image

@helloanoop
Copy link
Contributor

@ivycristina Can you share more details

Did you try disabling ssl?
Are you using custom CA cert ?

@ivycristina
Copy link

@ivycristina Can you share more details

Did you try disabling ssl? Are you using custom CA cert ?

I disabled SSL because it was giving another error and I threw it on the internet and said to disable it, I'm not using a certificate, I just brought the collection directly from postman to Bruno and there in postman it works without any token or certificate and here it doesn't want to work

@Schm1tz1
Copy link

@helloanoop - at least for me I can say that the issues are gone now, thanks a lot!

@Shackelford-Arden
Copy link

@helloanoop I'm on Bruno 1.6.1 and I still need to use the following to successfully make HTTPS.

Again for reference, I do have SSL verification disabled:

image

I do have a SOCKS5 proxy for these requests in particular.

Error message I'm getting:

image

Seems like there needs to be a way to make sure that validation for all certificates that are presented is skipped.

@Shackelford-Arden
Copy link

As an additional point there, if I run the same request via cURL while telling it to use the same proxy, the request is successful

@martinsefcik
Copy link
Contributor

martinsefcik commented Jan 18, 2024

@helloanoop @Shackelford-Arden
I think problem is in implementation of SOCKS proxy support.

Currently it is implemented like this:

if (socksEnabled) {
      const socksProxyAgent = new SocksProxyAgent(proxyUri);
      request.httpsAgent = socksProxyAgent;
      request.httpAgent = socksProxyAgent;
} 

So it completely ignores SSL verification and certificates configuration in httpsAgentRequestFields variable.

I think it should be changed to something like this:

    if (socksEnabled) {
      request.httpsAgent = new SocksProxyAgent(
          proxyUri,
          Object.keys(httpsAgentRequestFields).length > 0 ? { ...httpsAgentRequestFields } : undefined
      );
      request.httpAgent = new SocksProxyAgent(proxyUri);
} 

the same way how it is implemented for http(s) proxy.

@Shackelford-Arden
Copy link

@martinsefcik Nice find :)

As a quick test, I did the following to see if that would work:

  • Cloned the repo
  • Edited the following files w/ your suggestion:
    • packages/bruno-cli/src/runner/run-single-request.js
    • packages/bruno-electron/src/ipc/network/index.js
  • Following the steps provided in the contributing README on building Bruno
  • Ran Bruno from the source build
  • Ran the requests as I had before, and it worked 😄

@martinsefcik
Copy link
Contributor

@Shackelford-Arden

  • Ran the requests as I had before, and it worked 😄

Great! I can prepare PR for that tomorrow.

@martinsefcik
Copy link
Contributor

@geraintwjones @ivycristina Were you using also SOCKS proxy as @Shackelford-Arden when you had these errors ?

@martinsefcik
Copy link
Contributor

@Shackelford-Arden

  • Ran the requests as I had before, and it worked 😄

Great! I can prepare PR for that tomorrow.

I created separate issue #1419 for that and PR #1420

@ivycristina
Copy link

hello, I am using bruno-cli and wanted to generate a reports of the tests in html does it have this option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants