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

Issue 10908044: Refuse invalid SearchProvider and OSDD suggest URLs; etc. (Closed)

Created:
8 years, 3 months ago by msw
Modified:
8 years, 1 month ago
Reviewers:
Peter Kasting
CC:
chromium-reviews, James Su
Visibility:
Public.

Description

Refuse invalid SearchProvider and OSDD suggest URLs; etc. Change SearchProvider::CreateSuggestFetcher: Validate the TemplateURL[Ref] and suggest URL on search. Return NULL early if invalid; this prevents crashes. Change TemplateURLParsingContext::GetTemplateURL: Validate the TemplateURLRefs from OSDDs import. Return NULL early if invalid (don't import bad engines). Return NULL early on TemplateURLParser::Parse error. TODO(followup): Validate existing TemplateURLs in profile data? TODO(followup): Support invalid GURLs that may be valid after replacements. BUG=145852 TEST=Less crashes as reported in bug, import succeeds on [1], fails (no-op) on [2] and [3]... [1] http://ready.to/search/en/?sna=MSW_TEST_SUGGEST&prf=http%3A%2F%2Fsearch.yahoo.com%2Fsearch%3Fei%3D%7BinputEncoding%7D%26amp%3Bfr%3Dcrmas%26amp%3Bp%3D&des=MSW_TEST_SUGGEST&opt=%26lt%3BUrl%20type%3D%26quot%3Bapplication%2Fx-suggestions%2Bjson%26quot%3B%20template%3D%26quot%3Bhttp%3A%2F%2Fff.search.yahoo.com%2Fgossip%3Foutput%3Dfxjson%26amp%3Bcommand%3D%7BsearchTerms%7D%26quot%3B%2F%26gt%3B&in=utf&ou=ono&mod=pn# [2] http://ready.to/search/en/?sna=MSW_TEST_SUGGEST_BADSCHEME&prf=http%3A%2F%2Fsearch.yahoo.com%2Fsearch%3Fei%3D%7BinputEncoding%7D%26amp%3Bfr%3Dcrmas%26amp%3Bp%3D&des=MSW_TEST_SUGGEST_BADSCHEME&opt=%26lt%3BUrl%20type%3D%26quot%3Bapplication%2Fx-suggestions%2Bjson%26quot%3B%20template%3D%26quot%3Bbadscheme%3A%2F%2Fff.search.yahoo.com%2Fgossip%3Foutput%3Dfxjson%26amp%3Bcommand%3D%7BsearchTerms%7D%26quot%3B%2F%26gt%3B&in=utf&ou=ono&mod=pn# [3] http://ready.to/search/en/?sna=MSW_TEST_SUGGEST_BADOPENBRACE&prf=http%3A%2F%2Fsearch.yahoo.com%2Fsearch%3Fei%3D%7BinputEncoding%7D%26amp%3Bfr%3Dcrmas%26amp%3Bp%3D&des=MSW_TEST_SUGGEST_BADOPENBRACE&opt=%26lt%3BUrl%20type%3D%26quot%3Bapplication%2Fx-suggestions%2Bjson%26quot%3B%20template%3D%26quot%3Bhttp%3A%2F%2Fff.search.yahoo.com%2Fgossip%3Foutput%3Dfxjson%26amp%3Bcommand%3D%7BsearchTerms%7D%26amp%3Bfoo%3D%7Bbad%26quot%3B%2F%26gt%3B&in=utf&ou=ono&mod=pn Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=155315

Patch Set 1 #

Patch Set 2 : Bail on invalid TemplateURLRefs in searching and OSDD parsing. #

Total comments: 10

Patch Set 3 : Address comments. #

Total comments: 2

Patch Set 4 : Restore GURL validity DCHECKs, fix comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+46 lines, -43 lines) Patch
M chrome/browser/autocomplete/search_provider.h View 1 1 chunk +5 lines, -6 lines 0 comments Download
M chrome/browser/autocomplete/search_provider.cc View 1 2 2 chunks +20 lines, -20 lines 0 comments Download
M chrome/browser/search_engines/template_url_parser.cc View 1 2 3 3 chunks +21 lines, -17 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
msw
Hey Peter, please take a look; thanks! I'm investigating the importation of invalid OSDD separately.
8 years, 3 months ago (2012-08-31 19:32:43 UTC) #1
msw
Hey Peter, please take a look; thanks!
8 years, 3 months ago (2012-09-04 22:51:44 UTC) #2
Peter Kasting
http://codereview.chromium.org/10908044/diff/8001/chrome/browser/autocomplete/search_provider.cc File chrome/browser/autocomplete/search_provider.cc (right): http://codereview.chromium.org/10908044/diff/8001/chrome/browser/autocomplete/search_provider.cc#newcode638 chrome/browser/autocomplete/search_provider.cc:638: !template_url->suggestions_url_ref().IsValid()) You don't need to check IsValid(); if it ...
8 years, 3 months ago (2012-09-05 23:31:27 UTC) #3
msw
Addressed comments, please take another look, thanks! https://chromiumcodereview.appspot.com/10908044/diff/8001/chrome/browser/autocomplete/search_provider.cc File chrome/browser/autocomplete/search_provider.cc (right): https://chromiumcodereview.appspot.com/10908044/diff/8001/chrome/browser/autocomplete/search_provider.cc#newcode638 chrome/browser/autocomplete/search_provider.cc:638: !template_url->suggestions_url_ref().IsValid()) On ...
8 years, 3 months ago (2012-09-06 20:02:29 UTC) #4
Peter Kasting
I missed that IsHTTPRef() enforces that things are empty-or-valid. That's actually too strong a guarantee, ...
8 years, 3 months ago (2012-09-06 20:28:31 UTC) #5
msw
Thanks, landing. https://chromiumcodereview.appspot.com/10908044/diff/7003/chrome/browser/search_engines/template_url_parser.cc File chrome/browser/search_engines/template_url_parser.cc (right): https://chromiumcodereview.appspot.com/10908044/diff/7003/chrome/browser/search_engines/template_url_parser.cc#newcode147 chrome/browser/search_engines/template_url_parser.cc:147: // a resulting TempateURLRef was invalid, etc.). ...
8 years, 3 months ago (2012-09-06 20:38:35 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/msw@chromium.org/10908044/9002
8 years, 3 months ago (2012-09-06 20:41:11 UTC) #7
commit-bot: I haz the power
8 years, 3 months ago (2012-09-07 05:29:13 UTC) #8
Change committed as 155315

Powered by Google App Engine
This is Rietveld 408576698