Skip to content

[WIP] macOS: Add certificate trust API - #9068

Closed
joshaber wants to merge 14 commits into
electron:masterfrom
joshaber:certificate-trust
Closed

joshaber wants to merge 14 commits into
electron:masterfrom
joshaber:certificate-trust

Conversation

@joshaber

@joshaber joshaber commented Mar 30, 2017 •

Copy link
Copy Markdown
Contributor

Add the app.showCertificateTrust API to show the OS-provided UI to let the user decide to accept and trust a self-signed or untrusted certificate:

cert_trust_panel_5b4faf16-9b52-4d4f-8aa0-63b89361dd60

I believe this would address #1956. Negative, see the discussion below.

This is only the macOS-side of things. I think we can get @shiftkey to do the Windows side.

I'm opening this early because I have no idea what I'm doing and I'd welcome any feedback or advice anyone would like to provide.

@zeke

zeke commented Mar 30, 2017

Copy link
Copy Markdown
Contributor

Are you sure you want to trust this shady-looking cert?

lol

@joshaber wanna take a shot at the API docs for this?

@deepak1556

Copy link
Copy Markdown
Member

Instead of adding a separate api, what do you think about making app.importCertificate work for macOS ?

@joshaber

Copy link
Copy Markdown
Contributor Author

wanna take a shot at the API docs for this?

Yup, I'll definitely add docs before this is done.

Instead of adding a separate api, what do you think about making app.importCertificate work for macOS ?

I'm into that. I wasn't sure how overloaded we wanted to make that API, since this seems to be a little different from simply importing.

@deepak1556

Copy link
Copy Markdown
Member

Correct me if I am wrong, the purpose of showCertificateTrust api is to set the trust bits for already imported certificates ? If thats the case we can merge that behavior while importing. importCertificate api already adds the trust bits by default.

@joshaber

joshaber commented Mar 31, 2017 •

Copy link
Copy Markdown
Contributor Author

Right, the distinction I was thinking of was that while importCertificate does exactly what the name says it does, showCertificateTrust presents a UI where the user can choose what to do. So it's that distinction of do-the-thing vs. ask-the-user-and-maybe-do-it that I was talking about.

But like I said, I'm happy to defer to you all on this.

@deepak1556

Copy link
Copy Markdown
Member

Thanks for the explanation! the purpose is clear to me now. For #1956 users want an api that does all the import and setting trust bits, in a way that the app setup doesn't disturb their end users with UI dialogs. I am ok with adding this api, but if the purpose was to fix #1956 then importCertificate must be improved.

@joshaber

Copy link
Copy Markdown
Contributor Author

Ah, I see. The propose of this PR is separate from addressing #1956. I'll cross out the line about that.

@joshaber

Copy link
Copy Markdown
Contributor Author

This is getting close:

screen shot 2017-03-31 at 2 39 13 pm

The biggest issue is that we don't seem to get the entire certificate chain, so we can't approve untrusted roots. If anyone has any ideas, I'm all ears 👂.

@joshaber

joshaber commented Apr 1, 2017

Copy link
Copy Markdown
Contributor Author

Alright, this seems to be working with the entire certificate chain now. A little more clean up and this should be good to go.

screen shot 2017-03-31 at 9 31 18 pm

@kevinsawicki

Copy link
Copy Markdown
Contributor

This is only the macOS-side of things. I think we can get @shiftkey to do the Windows side.

Is there a roughly similar equivalent UI/flow on Windows?

Just wondering because the macOS version of this seems like an API that might best fit on dialog, something like dialog.showCertificateTrustDialog(options, callback) vs. having it on app.

@joshaber

joshaber commented Apr 3, 2017

Copy link
Copy Markdown
Contributor Author

Is there a roughly similar equivalent UI/flow on Windows?

@shiftkey could answer this better than I, but as best as I know it's pretty similar. There's a dialog box that shows some info about the certificate and gives you the option of importing.

I'm down to move it to dialog 👍

@joshaber

joshaber commented Apr 3, 2017

Copy link
Copy Markdown
Contributor Author

Gonna re-open in the repository proper so I get full CI.

@shiftkey

shiftkey commented Apr 3, 2017

Copy link
Copy Markdown
Contributor

@joshaber @kevinsawicki

Is there a roughly similar equivalent UI/flow on Windows?

The first flow that came to mind was from Fiddler - a HTTP debugging app for Windows. To decrypt HTTPS traffic it needs to install a trusted root certificate so that it can act as a proxy and rewrite HTTPS requests on-the-fly.

Here's the flow it uses:

  • First, a couple of clear warning messages:


  • Then an external program launches elevated to install the certificate (because trusted root):

  • This then confirms again that you want to do what you wanted:

  • And you're done:

Unfortunately I haven't found a good equivalent on Windows to the unified "here's the details, do you trust this cert?" screenshot from @joshaber above:

But I'll report back soon on what I can find...

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

Successfully merging this pull request may close these issues.

5 participants