• lazyboy's avatar
    Fix content verification code for undreadable and deleted files. · d6dbb26e
    lazyboy authored
    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}
    d6dbb26e
content_verify_job.h 4.98 KB