Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Issue 12190 - Enabling certificate pinning for Brave domains #401

Merged
merged 1 commit into from
Dec 29, 2017

Conversation

jumde
Copy link
Contributor

@jumde jumde commented Dec 13, 2017

…mains

@diracdeltas
Copy link
Member

commit message should probably be changed because this doesn't enable expect-ct. otherwise lgtm.

cc @ayumi @evq @aekeus

@jumde jumde changed the title Issue 12190 - Enabling certificate pinning and expect CT for Brave do… Issue 12190 - Enabling certificate pinning for Brave domains Dec 13, 2017
@jumde
Copy link
Contributor Author

jumde commented Dec 13, 2017

Updated!

{ "name": "preloaded-expect-staple-include-subdomains.badssl.com", "expect_staple": true, "expect_staple_report_uri": "https://report.badssl.com/expect-staple", "include_subdomains_for_expect_staple": true },

+ //Brave
+ { "name": "ledger.mercury.basicattentiontoken.org", "mode": "force-https", "pins": "brave"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ledger client also reaches out to balance.mercury.basicattentiontoken.org

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are also -staging equivalents

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update, what about publishers.basicattentiontoken.org?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't believe that domain is used in browser-laptop

Copy link
Collaborator

@bridiver bridiver Dec 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to find a better way to handle this because this patch is way too big. If we're going to make this many changes we would be better off patching net/http/transport_security_state.h to use our own kDefaultHSTSSource

@diracdeltas
Copy link
Member

follow ups from ryan sleevi:

- { "name": "youtu.be", "include_subdomains": true, "pins": "google" },
- { "name": "youtube-nocookie.com", "include_subdomains": true, "pins": "google" },
- { "name": "ytimg.com", "include_subdomains": true, "pins": "google" },
+ { "name": "2mdn.net", "include_subdomains": true },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please verify if this is true, but I think all the entries without a "mode" or "pins" property would do nothing and thus can be deleted

@jumde jumde assigned jumde and diracdeltas and unassigned jumde Dec 15, 2017
@diracdeltas
Copy link
Member

changes look good to me! need review from @bridiver or @darkdh . i wonder if there's a way to write an automated test for this?

+ { "name": "sync.brave.com", "mode": "force-https", "pins": "brave"},
+ { "name": "sync-staging.brave.com", "mode": "force-https", "pins": "brave"},
+ { "name": "brave-laptop-updates.global.ssl.fastly.net", "mode": "force-https", "pins": "brave"},
+ { "name": "brave-download.global.ssl.fastly.net", "mode": "force-https", "pins": "brave"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to wait on brave/browser-laptop#12301 so we can pin brave.com domains instead of fastly.net domains

@jumde jumde requested a review from darkdh December 18, 2017 00:22
@jumde jumde assigned darkdh and jumde and unassigned diracdeltas and darkdh Dec 18, 2017
- enable_static_pins_ = false;
enable_static_expect_ct_ = false;
#endif
+ enable_static_pins_ = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use

#if !defined(MUON_CHROMIUM_BUILD)
enable_static_pins_ = true;
#endif

Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will make patch file bloated in order to unpin those entries. We should keep patch minimized for the sake of chromium upgrade. @bridiver ^^^

darkdh
darkdh previously approved these changes Dec 19, 2017
Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm now. Please squash the commits

# Inputs in order expected by the command line of the tool.
inputs = [
- "transport_security_state_static.json",
+ "//electron/atom/browser/resources/transport_security_state_static.json",
Copy link
Member

@diracdeltas diracdeltas Dec 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file should be updated with every Chromium rebase using transport_security_state_static.json what's the best process for doing that? maybe some kind of post-commit script that runs after every rebase?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tricky parts seems to be that we both add and remove entries. If we were only adding them it would be much easier because we could just merge the two files in another gn task. Is it necessary to remove entries?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe we could minimize the diff by removing the entries from chrome transport_security_state_static.json as a patch and then merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that before moving transport_security_state_static.json to the electron code, it'll be hard to maintain if we do that. I think a separate file makes gives us more control over the pinned domains.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridiver it's necessary to remove entries because Google told us we shouldn't do certificate pinning for sites we don't have a point-of-contact for in case they break. however, it's probably safe for us to do force-https on any site. so @jumde's list removes the pins property for non-Brave entries that have it but keeps the force-https property

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diracdeltas are there any changes that still need to be made here then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridiver i think this PR is fine as-is

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but as-mentioned above, there should be a follow up issue for downstream list maintenance (making sure it happens every browser-laptop release)

diracdeltas
diracdeltas previously approved these changes Dec 19, 2017
Copy link
Member

@diracdeltas diracdeltas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding to https://github.com/brave/muon/pull/401/files#r157640158
I think the cost of manual applying changes is too high, see upcoming changes https://chromium.googlesource.com/chromium/src.git/+/63.0.3239.108..64.0.3282.24/net/http/transport_security_state_static.json and it is error-prone

we should generated a our own transport_security_state_static.h for brave pinsets and include it in net/http/transport_security_state.cc

darkdh
darkdh previously approved these changes Dec 19, 2017
Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per discussion on slack, @jumde will be in charged of maintaining JSON file. And @diracdeltas suggest we do upgrade every Brave release instead of chromium upgrade

@bridiver bridiver added this to the 4.6.3 milestone Dec 29, 2017
@bridiver bridiver merged commit f95459f into master Dec 29, 2017
bridiver added a commit that referenced this pull request Dec 29, 2017
Issue 12190 - Enabling certificate pinning for Brave domains
@bsclifton bsclifton deleted the brave_ct branch January 17, 2018 16:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants