New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 648508 link

Starred by 7 users

Issue metadata

Status: Fixed
Owner:
Buried. Ping if important.
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug



Sign in to add a comment

Wildcard handling of content security policy has changed, no longer covers file://

Reported by tobias.w...@loxone.com, Sep 20 2016

Issue description

We had the following CSP-Meta-Tag in our Cordova app:
<meta http-equiv="Content-Security-Policy" content="img-src * data: blob:; child-src * blob:; connect-src * ws:; default-src * blob:; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval' blob:">

Since we're on Cordova, most of the files are provided via "file://" and so far the wildcard did allow that. Since 54.0.2840.25 the wilcard (*) no longer covers "file://" and therefore cordova apps that do not explicitly allow for "file://" to load will no longer work.


Device name: Samsung Galaxy S6 and probably every other device too.
Android version: 6.0.1
WebView version (from system settings -> Apps -> Android System WebView): 54.0.2840.25
Application: Loxone Smart Home - and other Cordova Apps.
Application version: 7.0.2 (2016.09.05)

URLs (if applicable):
App won't start.

Steps to reproduce:
(1) get (its free) and open app.
(2) See a blank screen

Expected result:
App opens. 

Actual result:
App shows a blank screen as no scripts/styles/images are loaded due to content security policy changes.

 

Comment 1 by torne@chromium.org, Sep 20 2016

Components: Blink>SecurityFeature
Owner: mkwst@chromium.org
What's the origin of the file you are loading? Is it also being loaded from file:// or is it loaded from elsewhere?

Mike, was this an intentional change in M54? It seems potentially related to the discussion at https://github.com/w3c/webappsec-csp/issues/104 ? I don't know how widespread use of CSP meta tags is in cordova applications, but if it's common and the handling of file: origins changed, there might be a lot of apps impacted :/
The scripts/styles/images in Cordova apps are loaded from "file://".

Comment 3 by torne@chromium.org, Sep 20 2016

Where is the *document* that references those scripts/styles/images loaded from, though? What is the actual origin of the current page?
file:///android_asset/www/index.html#

Comment 5 by torne@chromium.org, Sep 26 2016

Labels: -Pri-3 M-54 ReleaseBlock-Stable Pri-1
 Issue 650154  looks related also.

Comment 6 by mkwst@chromium.org, Sep 26 2016

Cc: shek...@gmail.com
I assume this is one of shekyan@'s patches which touched `*`. According to the spec, `*` should still include `file:` if included on a page that it itself loaded from `file:`. CCing.

Looking more closely, I think we just missed this bit in https://codereview.chromium.org/2209113002. I'll put up a patch.

Comment 7 by shek...@gmail.com, Sep 26 2016

https://codereview.chromium.org/2209113002 reflects the spec at the time of implementation. So I implemented what spec said at that time, and completely forgot to  update the Chromium implementation once https://github.com/w3c/webappsec-csp/issues/104 was addressed in the spec. 
Project Member

Comment 8 by bugdroid1@chromium.org, Sep 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d55f533b68355157431105281d485ef368e857a6

commit d55f533b68355157431105281d485ef368e857a6
Author: mkwst <mkwst@chromium.org>
Date: Tue Sep 27 06:34:18 2016

Relax '*' in CSPSourceList to match the protected resource's protocol.

'*' should match 'file://whatever.jpg' when loaded from 'file://document.html'.
The patch in [1] tightened '*'s behavior, but missed this bit.

[1]: https://codereview.chromium.org/2209113002

BUG= 648508 

Review-Url: https://codereview.chromium.org/2368073003
Cr-Commit-Position: refs/heads/master@{#421129}

[modify] https://crrev.com/d55f533b68355157431105281d485ef368e857a6/third_party/WebKit/Source/core/frame/csp/CSPSourceList.cpp
[modify] https://crrev.com/d55f533b68355157431105281d485ef368e857a6/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp

Comment 9 by mkwst@chromium.org, Sep 27 2016

Labels: Merge-Request-54
Landed; assuming this doesn't explode in tomorrow's canary, I'll request a merge back to beta so folks can test their webview apps.

Comment 10 by dimu@chromium.org, Sep 27 2016

Labels: -Merge-Request-54 Merge-Approved-54 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M54 (branch: 2840)

Comment 11 by torne@chromium.org, Sep 27 2016

 Issue 650154  has been merged into this issue.

Comment 12 by mkwst@chromium.org, Sep 27 2016

I didn't actually mean to request permission to merge... :) I'll just wait until after tomorrow's Canary is pushed out.
[Bulk edit]

This issue is listed as a release block stable for M54 Android.  We'll be cutting our stable candidate in just about two weeks, so time is running out to fix this bug - please prioritize working on it ASAP.

Are you sure this issue shouldn't block the release?  Remove the ReleaseBlock-Stable label.
Unsure if this issue should block the release, or know the issue should block the release but we won't be able to fix it in time?  CC me so that we can discuss.

Thanks!
Status: Assigned (was: Unconfirmed)
Setting appropriate status.  Please get this merged by end of week; I'll make sure we get a canary deployed today so you can test.
Project Member

Comment 15 by bugdroid1@chromium.org, Sep 29 2016

Labels: -merge-approved-54 merge-merged-2840
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/45b9a9238953dcffddcaa40ef5c7d9c5e2d48592

commit 45b9a9238953dcffddcaa40ef5c7d9c5e2d48592
Author: Mike West <mkwst@google.com>
Date: Thu Sep 29 10:05:53 2016

Relax '*' in CSPSourceList to match the protected resource's protocol.

'*' should match 'file://whatever.jpg' when loaded from 'file://document.html'.
The patch in [1] tightened '*'s behavior, but missed this bit.

[1]: https://codereview.chromium.org/2209113002

BUG= 648508 

Review-Url: https://codereview.chromium.org/2368073003
Cr-Commit-Position: refs/heads/master@{#421129}
(cherry picked from commit d55f533b68355157431105281d485ef368e857a6)

Review URL: https://codereview.chromium.org/2375423002 .

Cr-Commit-Position: refs/branch-heads/2840@{#577}
Cr-Branched-From: 1ae106dbab4bddd85132d5b75c670794311f4c57-refs/heads/master@{#414607}

[modify] https://crrev.com/45b9a9238953dcffddcaa40ef5c7d9c5e2d48592/third_party/WebKit/Source/core/frame/csp/CSPSourceList.cpp
[modify] https://crrev.com/45b9a9238953dcffddcaa40ef5c7d9c5e2d48592/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp

Comment 16 by mkwst@chromium.org, Sep 29 2016

Status: Fixed (was: Assigned)
Merged to beta. If it explodes, we'll try again. :)
Verified on latest webview M54/ Galaxy S6/MMB29K
Project Member

Comment 18 by bugdroid1@chromium.org, Oct 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/45b9a9238953dcffddcaa40ef5c7d9c5e2d48592

commit 45b9a9238953dcffddcaa40ef5c7d9c5e2d48592
Author: Mike West <mkwst@google.com>
Date: Thu Sep 29 10:05:53 2016

Relax '*' in CSPSourceList to match the protected resource's protocol.

'*' should match 'file://whatever.jpg' when loaded from 'file://document.html'.
The patch in [1] tightened '*'s behavior, but missed this bit.

[1]: https://codereview.chromium.org/2209113002

BUG= 648508 

Review-Url: https://codereview.chromium.org/2368073003
Cr-Commit-Position: refs/heads/master@{#421129}
(cherry picked from commit d55f533b68355157431105281d485ef368e857a6)

Review URL: https://codereview.chromium.org/2375423002 .

Cr-Commit-Position: refs/branch-heads/2840@{#577}
Cr-Branched-From: 1ae106dbab4bddd85132d5b75c670794311f4c57-refs/heads/master@{#414607}

[modify] https://crrev.com/45b9a9238953dcffddcaa40ef5c7d9c5e2d48592/third_party/WebKit/Source/core/frame/csp/CSPSourceList.cpp
[modify] https://crrev.com/45b9a9238953dcffddcaa40ef5c7d9c5e2d48592/third_party/WebKit/Source/core/frame/csp/CSPSourceListTest.cpp

Sign in to add a comment