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

Issue 2771953003: Fix content verification code for undreadable and deleted files. (Closed)

Created:
3 years, 9 months ago by lazyboy
Modified:
3 years, 8 months ago
Reviewers:
Devlin
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix content verification code for undreadable and deleted files. It seems that corruption examples in crbug.com/699420 can cause extension resource files to go missing or become unreadable. Fix a bug where we never sent any notification to ContentVerifyJob, in particular: we never called ContentVerifyJob::DoneReading(). Override URLRequestFileJob::OnOpenComplete in URLRequestExtensionJob to catch these cases. Also make ContentHashReader not skip legitimate deleted files: the files that are listed in verified_contents.json. It will still skip non-existent resources, e.g. xhrs requesting non-existent file (see crbug.com/404802 for example). BUG=703888 Test=Install an extension (not app) in chromeos. Chromeos because you want content verification enforcement to kick in. Other way could be to use --extension-content-verification=enforce_strict flag in other platform. Either: 1) Delete background script file. Content verifcation would kick in when you try to load/run the extension. 2) Same as above^^^, instead of deleting the file, remove the file permission. In linux you can just do "chmod -r background.js". Expect content verification failure. In both cases extension should be reinstalled in the end. Review-Url: https://codereview.chromium.org/2771953003 Cr-Commit-Position: refs/heads/master@{#460607} Committed: https://chromium.googlesource.com/chromium/src/+/d6dbb26e31818eed0097654ecb89aaddc2c64f8d

Patch Set 1 #

Patch Set 2 : . #

Total comments: 20

Patch Set 3 : address comments + fix compile #

Patch Set 4 : . #

Total comments: 12

Patch Set 5 : address comments #

Patch Set 6 : fix win compile: FILE_PATH_LITERAL issue, call ContentVerifier::Shutdown #

Patch Set 7 : sync #

Total comments: 2

Patch Set 8 : sync #

Patch Set 9 : Fix deleted file case and also make sure crbug 404802 does not regress #

Total comments: 18

Patch Set 10 : address comments change DCHECK #

Unified diffs Side-by-side diffs Delta from patch set Stats (+484 lines, -49 lines) Patch
M chrome/browser/extensions/content_verifier_browsertest.cc View 1 2 3 4 5 6 7 8 9 4 chunks +8 lines, -6 lines 0 comments Download
M chrome/browser/extensions/extension_protocols_unittest.cc View 1 2 3 4 5 9 chunks +148 lines, -9 lines 0 comments Download
M extensions/browser/BUILD.gn View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M extensions/browser/content_hash_reader.h View 1 2 3 4 5 6 7 8 2 chunks +7 lines, -6 lines 0 comments Download
M extensions/browser/content_hash_reader.cc View 1 2 3 4 5 6 7 8 3 chunks +11 lines, -11 lines 0 comments Download
M extensions/browser/content_verify_job.h View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -1 line 0 comments Download
M extensions/browser/content_verify_job.cc View 1 2 3 4 5 6 7 8 4 chunks +32 lines, -15 lines 0 comments Download
A extensions/browser/content_verify_job_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +252 lines, -0 lines 0 comments Download
M extensions/browser/extension_protocols.cc View 1 2 3 4 1 chunk +14 lines, -0 lines 0 comments Download
M extensions/browser/scoped_ignore_content_verifier_for_test.h View 1 1 chunk +1 line, -1 line 0 comments Download
A extensions/test/data/content_hash_fetcher/with_verified_contents/README.txt View 1 2 3 4 5 6 7 8 9 1 chunk +7 lines, -0 lines 0 comments Download
A extensions/test/data/content_hash_fetcher/with_verified_contents/source_all.zip View 1 2 3 4 5 6 7 8 9 Binary file 0 comments Download

Messages

Total messages: 43 (31 generated)
lazyboy
3 years, 9 months ago (2017-03-24 01:15:37 UTC) #3
Devlin
(also looks like maybe a compile error on the bots?) https://codereview.chromium.org/2771953003/diff/20001/chrome/browser/extensions/extension_protocols_unittest.cc File chrome/browser/extensions/extension_protocols_unittest.cc (right): https://codereview.chromium.org/2771953003/diff/20001/chrome/browser/extensions/extension_protocols_unittest.cc#newcode61 ...
3 years, 9 months ago (2017-03-24 02:01:45 UTC) #7
lazyboy
https://codereview.chromium.org/2771953003/diff/20001/chrome/browser/extensions/extension_protocols_unittest.cc File chrome/browser/extensions/extension_protocols_unittest.cc (right): https://codereview.chromium.org/2771953003/diff/20001/chrome/browser/extensions/extension_protocols_unittest.cc#newcode61 chrome/browser/extensions/extension_protocols_unittest.cc:61: if (!base::CreateDirectory(full_path.DirName())) On 2017/03/24 02:01:44, Devlin wrote: > In ...
3 years, 9 months ago (2017-03-24 18:27:48 UTC) #10
Devlin
lgtm; just a few more tiny nits. https://codereview.chromium.org/2771953003/diff/60001/chrome/browser/extensions/extension_protocols_unittest.cc File chrome/browser/extensions/extension_protocols_unittest.cc (right): https://codereview.chromium.org/2771953003/diff/60001/chrome/browser/extensions/extension_protocols_unittest.cc#newcode61 chrome/browser/extensions/extension_protocols_unittest.cc:61: return (static_cast<size_t>(result) ...
3 years, 9 months ago (2017-03-24 18:50:10 UTC) #11
lazyboy
https://codereview.chromium.org/2771953003/diff/60001/chrome/browser/extensions/extension_protocols_unittest.cc File chrome/browser/extensions/extension_protocols_unittest.cc (right): https://codereview.chromium.org/2771953003/diff/60001/chrome/browser/extensions/extension_protocols_unittest.cc#newcode61 chrome/browser/extensions/extension_protocols_unittest.cc:61: return (static_cast<size_t>(result) == content.size()); On 2017/03/24 18:50:09, Devlin wrote: ...
3 years, 9 months ago (2017-03-24 19:22:56 UTC) #14
lazyboy
https://codereview.chromium.org/2771953003/diff/120001/extensions/browser/content_verify_job.cc File extensions/browser/content_verify_job.cc (right): https://codereview.chromium.org/2771953003/diff/120001/extensions/browser/content_verify_job.cc#newcode136 extensions/browser/content_verify_job.cc:136: if (hashes_ready_) { Ugh, unfortunately, I'm struggling with edge ...
3 years, 8 months ago (2017-03-28 01:50:19 UTC) #29
lazyboy
https://codereview.chromium.org/2771953003/diff/120001/extensions/browser/content_verify_job.cc File extensions/browser/content_verify_job.cc (right): https://codereview.chromium.org/2771953003/diff/120001/extensions/browser/content_verify_job.cc#newcode136 extensions/browser/content_verify_job.cc:136: if (hashes_ready_) { On 2017/03/28 01:50:19, lazyboy wrote: > ...
3 years, 8 months ago (2017-03-29 02:16:31 UTC) #31
Devlin
Still mostly good, but a few more comments https://codereview.chromium.org/2771953003/diff/160001/chrome/browser/extensions/content_verifier_browsertest.cc File chrome/browser/extensions/content_verifier_browsertest.cc (right): https://codereview.chromium.org/2771953003/diff/160001/chrome/browser/extensions/content_verifier_browsertest.cc#newcode253 chrome/browser/extensions/content_verifier_browsertest.cc:253: : ...
3 years, 8 months ago (2017-03-29 15:51:57 UTC) #32
lazyboy
Thanks for the review, comments addressed in PS #10 https://codereview.chromium.org/2771953003/diff/160001/chrome/browser/extensions/content_verifier_browsertest.cc File chrome/browser/extensions/content_verifier_browsertest.cc (right): https://codereview.chromium.org/2771953003/diff/160001/chrome/browser/extensions/content_verifier_browsertest.cc#newcode253 chrome/browser/extensions/content_verifier_browsertest.cc:253: ...
3 years, 8 months ago (2017-03-29 17:12:51 UTC) #34
Devlin
lgtm
3 years, 8 months ago (2017-03-29 18:23:44 UTC) #35
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/2771953003/200001
3 years, 8 months ago (2017-03-29 23:54:21 UTC) #40
commit-bot: I haz the power
3 years, 8 months ago (2017-03-30 00:58:20 UTC) #43
Message was sent while issue was closed.
Committed patchset #10 (id:200001) as
https://chromium.googlesource.com/chromium/src/+/d6dbb26e31818eed0097654ecb89...

Powered by Google App Engine
This is Rietveld 408576698