DescriptionFix 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 #Messages
Total messages: 43 (31 generated)
|