Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Issue 2433583002: Reduce buggy usage of the registry controlled domain service. (Closed)

Created:
4 years, 2 months ago by brettw
Modified:
4 years, 1 month ago
CC:
chromium-reviews, mlamouri+watch-content_chromium.org, cbentzel+watch_chromium.org, extensions-reviews_chromium.org, grt+watch_chromium.org, jam, darin-cc_chromium.org, chromium-apps-reviews_chromium.org, pam+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Reduce buggy usage of the registry controlled domain service. GetRegistryLength for host names canonicalizes the input for the caller, but then returns the length in the canonicalized input, which is not necessarily the same as the length in the original string. As a result, computations performed by the caller based on this value can be wrong (see the bug for more). All callers of this function were audited and changed to use on of the following: - Many callers don't need the offsets. A new function HostHasRegistryControlledDomain is added to check for the presence of a R.C.D. without the risk of returning incorrect string lengths. - Many callers already have guaranteed-canonical strings (they came out of a GURL or KURL object soon before the call) These were changed to use a new GetCanonicalHostRegistryLength function. A further advantage is that these calls will be faster. - A new Permissive function is added that handles cases where the input is necessarily non-canonical. Adds an IDN test case to the unit tests. Removes checking for IP addresses in the already-known-canonical cases. This requires a separate full canonicalization and IP addresses should never match the R.C.D. list. BUG=657199 Committed: https://crrev.com/060f6a0de7706cc43f9d773ae9ce2cb36bc9964d Cr-Commit-Position: refs/heads/master@{#427545}

Patch Set 1 #

Patch Set 2 : Merge #

Patch Set 3 : . #

Total comments: 3

Patch Set 4 : Fix typo #

Patch Set 5 : Handle more cases #

Patch Set 6 : . #

Patch Set 7 : Fix #

Total comments: 90

Patch Set 8 : Review comments #

Total comments: 13

Patch Set 9 : Review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+651 lines, -272 lines) Patch
M chrome/browser/android/history_report/delta_file_commons.cc View 1 2 3 4 2 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/supervised_user/supervised_user_url_filter.h View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/supervised_user/supervised_user_url_filter.cc View 1 2 3 4 2 chunks +6 lines, -5 lines 0 comments Download
M chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -3 lines 0 comments Download
M components/google/core/browser/google_util.cc View 1 2 3 4 5 6 7 8 5 chunks +24 lines, -20 lines 0 comments Download
M components/history/core/browser/history_backend.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M components/omnibox/browser/autocomplete_input.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M components/omnibox/browser/history_quick_provider.cc View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -8 lines 0 comments Download
M components/omnibox/browser/history_url_provider.cc View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -5 lines 0 comments Download
M components/search_engines/template_url_service.cc View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -3 lines 0 comments Download
M components/ssl_errors/error_classification.h View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M components/ssl_errors/error_classification.cc View 1 2 3 4 5 6 7 8 5 chunks +7 lines, -10 lines 0 comments Download
M components/ssl_errors/error_classification_unittest.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -3 lines 0 comments Download
M components/url_formatter/url_fixer.cc View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -13 lines 0 comments Download
M content/renderer/webpublicsuffixlist_impl.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/webpublicsuffixlist_impl.cc View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -6 lines 0 comments Download
M extensions/common/csp_validator.cc View 1 chunk +2 lines, -4 lines 0 comments Download
M extensions/common/manifest_handlers/externally_connectable.cc View 1 2 3 4 5 6 7 8 3 chunks +15 lines, -11 lines 0 comments Download
M extensions/common/permissions/permission_message_util.cc View 1 2 3 4 1 chunk +5 lines, -4 lines 0 comments Download
M extensions/common/url_pattern.cc View 1 2 3 4 5 6 7 1 chunk +11 lines, -15 lines 0 comments Download
M net/base/registry_controlled_domains/effective_tld_names_unittest1.gperf View 1 chunk +1 line, -0 lines 0 comments Download
M net/base/registry_controlled_domains/registry_controlled_domain.h View 1 2 3 4 5 6 7 8 2 chunks +53 lines, -5 lines 0 comments Download
M net/base/registry_controlled_domains/registry_controlled_domain.cc View 1 2 3 4 5 6 7 8 3 chunks +173 lines, -14 lines 0 comments Download
M net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc View 1 2 3 4 5 6 7 8 8 chunks +197 lines, -104 lines 0 comments Download
M net/base/url_util.cc View 1 chunk +3 lines, -4 lines 0 comments Download
M net/cert/cert_verify_proc.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -5 lines 0 comments Download
M net/cert/x509_certificate.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/public/platform/WebPublicSuffixList.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M url/url_canon.h View 1 2 3 4 5 6 7 8 1 chunk +27 lines, -0 lines 0 comments Download
M url/url_canon_host.cc View 1 2 3 4 5 6 7 8 4 chunks +35 lines, -18 lines 0 comments Download
M url/url_canon_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +44 lines, -0 lines 0 comments Download

Messages

Total messages: 78 (47 generated)
brettw
Merge
4 years, 2 months ago (2016-10-19 17:56:30 UTC) #6
brettw
.
4 years, 2 months ago (2016-10-19 20:10:51 UTC) #12
brettw
https://codereview.chromium.org/2433583002/diff/40001/components/google/core/browser/google_util.cc File components/google/core/browser/google_util.cc (right): https://codereview.chromium.org/2433583002/diff/40001/components/google/core/browser/google_util.cc#newcode91 components/google/core/browser/google_util.cc:91: const GURL& base_url(CommandLineGoogleBaseURL()); This is separated out from below ...
4 years, 2 months ago (2016-10-19 20:16:36 UTC) #17
brettw
https://codereview.chromium.org/2433583002/diff/40001/net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc File net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc (right): https://codereview.chromium.org/2433583002/diff/40001/net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc#newcode278 net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc:278: EXPECT_EQ(10U, BuggyGetHostRegistryLength("foo.xn--fiqs8s", This has a bug but I'm not ...
4 years, 2 months ago (2016-10-19 20:17:43 UTC) #18
brettw
Fix typo
4 years, 2 months ago (2016-10-20 17:35:31 UTC) #21
brettw
PS4 fixes a typo, you may want to review PS3 since I left a couple ...
4 years, 2 months ago (2016-10-20 17:35:52 UTC) #23
Peter Kasting
I may be slow reviewing this; I just got placed on unscheduled sheriff duty for ...
4 years, 2 months ago (2016-10-20 17:39:40 UTC) #25
brettw
Actually hold off on this, I think I found a solution to do it correctly.
4 years, 1 month ago (2016-10-21 17:51:02 UTC) #28
brettw
.
4 years, 1 month ago (2016-10-21 21:58:31 UTC) #35
brettw
Okay, this is ready now, this actually fixes the bug now rather than leaving the ...
4 years, 1 month ago (2016-10-21 21:59:50 UTC) #38
brettw
Fix
4 years, 1 month ago (2016-10-21 22:52:25 UTC) #41
Peter Kasting
https://codereview.chromium.org/2433583002/diff/120001/chrome/browser/android/history_report/delta_file_commons.cc File chrome/browser/android/history_report/delta_file_commons.cc (right): https://codereview.chromium.org/2433583002/diff/120001/chrome/browser/android/history_report/delta_file_commons.cc#newcode19 chrome/browser/android/history_report/delta_file_commons.cc:19: using net::registry_controlled_domains::GetCanonicalHostRegistryLength; Nit: I'd just qualify the name directly ...
4 years, 1 month ago (2016-10-22 05:04:20 UTC) #46
brettw
Review comments
4 years, 1 month ago (2016-10-24 21:44:51 UTC) #47
brettw
new snap up. https://codereview.chromium.org/2433583002/diff/120001/chrome/browser/android/history_report/delta_file_commons.cc File chrome/browser/android/history_report/delta_file_commons.cc (right): https://codereview.chromium.org/2433583002/diff/120001/chrome/browser/android/history_report/delta_file_commons.cc#newcode19 chrome/browser/android/history_report/delta_file_commons.cc:19: using net::registry_controlled_domains::GetCanonicalHostRegistryLength; I left as-is. I ...
4 years, 1 month ago (2016-10-24 21:45:25 UTC) #49
Peter Kasting
Have not yet re-reviewed, just replying to a few things. Fast work! This was a ...
4 years, 1 month ago (2016-10-24 23:04:32 UTC) #51
Peter Kasting
LGTM, but if possible, please try to get sufficient approval from a relevant OWNER of ...
4 years, 1 month ago (2016-10-25 01:33:33 UTC) #54
asargent_no_longer_on_chrome
https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc File extensions/common/manifest_handlers/externally_connectable.cc (right): https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc#newcode149 extensions/common/manifest_handlers/externally_connectable.cc:149: NOTREACHED() << *it; On 2016/10/24 23:04:32, Peter Kasting wrote: ...
4 years, 1 month ago (2016-10-25 18:20:49 UTC) #56
brettw
On 2016/10/25 18:20:49, Antony Sargent wrote: > https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc > File extensions/common/manifest_handlers/externally_connectable.cc (right): > > https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc#newcode149 ...
4 years, 1 month ago (2016-10-25 20:03:12 UTC) #57
Peter Kasting
https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc File extensions/common/manifest_handlers/externally_connectable.cc (right): https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc#newcode149 extensions/common/manifest_handlers/externally_connectable.cc:149: NOTREACHED() << *it; On 2016/10/25 18:20:49, Antony Sargent wrote: ...
4 years, 1 month ago (2016-10-25 20:28:18 UTC) #58
brettw
https://codereview.chromium.org/2433583002/diff/120001/components/omnibox/browser/history_quick_provider.cc File components/omnibox/browser/history_quick_provider.cc (right): https://codereview.chromium.org/2433583002/diff/120001/components/omnibox/browser/history_quick_provider.cc#newcode156 components/omnibox/browser/history_quick_provider.cc:156: } I removed "Probably" from the comment. https://codereview.chromium.org/2433583002/diff/120001/net/base/registry_controlled_domains/registry_controlled_domain.cc File ...
4 years, 1 month ago (2016-10-25 20:28:18 UTC) #59
brettw
Review comments
4 years, 1 month ago (2016-10-25 20:28:32 UTC) #60
Peter Kasting
https://codereview.chromium.org/2433583002/diff/120001/net/base/registry_controlled_domains/registry_controlled_domain.cc File net/base/registry_controlled_domains/registry_controlled_domain.cc (right): https://codereview.chromium.org/2433583002/diff/120001/net/base/registry_controlled_domains/registry_controlled_domain.cc#newcode277 net/base/registry_controlled_domains/registry_controlled_domain.cc:277: current_try >= static_cast<int>(mapping.original_begin); On 2016/10/25 20:28:17, brettw (ping on ...
4 years, 1 month ago (2016-10-25 20:37:53 UTC) #63
asargent_no_longer_on_chrome
https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc File extensions/common/manifest_handlers/externally_connectable.cc (right): https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc#newcode149 extensions/common/manifest_handlers/externally_connectable.cc:149: NOTREACHED() << *it; On 2016/10/25 20:28:17, Peter Kasting wrote: ...
4 years, 1 month ago (2016-10-25 20:57:13 UTC) #64
Peter Kasting
https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc File extensions/common/manifest_handlers/externally_connectable.cc (right): https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc#newcode149 extensions/common/manifest_handlers/externally_connectable.cc:149: NOTREACHED() << *it; On 2016/10/25 20:57:13, Antony Sargent wrote: ...
4 years, 1 month ago (2016-10-25 21:05:19 UTC) #65
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2433583002/160001
4 years, 1 month ago (2016-10-25 21:46:46 UTC) #69
asargent_no_longer_on_chrome
https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc File extensions/common/manifest_handlers/externally_connectable.cc (right): https://codereview.chromium.org/2433583002/diff/120001/extensions/common/manifest_handlers/externally_connectable.cc#newcode149 extensions/common/manifest_handlers/externally_connectable.cc:149: NOTREACHED() << *it; On 2016/10/25 21:05:19, Peter Kasting wrote: ...
4 years, 1 month ago (2016-10-25 23:37:55 UTC) #70
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 1 month ago (2016-10-26 00:24:01 UTC) #72
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/060f6a0de7706cc43f9d773ae9ce2cb36bc9964d Cr-Commit-Position: refs/heads/master@{#427545}
4 years, 1 month ago (2016-10-26 00:26:00 UTC) #74
wychen
Could this be the cause of net_unittests failure? https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20Builder%20%28dbg%29/builds/3366
4 years, 1 month ago (2016-10-26 01:12:02 UTC) #76
wychen
A revert of this CL (patchset #9 id:160001) has been created in https://codereview.chromium.org/2454553002/ by wychen@chromium.org. ...
4 years, 1 month ago (2016-10-26 01:19:40 UTC) #77
wychen
4 years, 1 month ago (2016-10-26 23:27:04 UTC) #78

Powered by Google App Engine
This is Rietveld 408576698