Bug 109429 - CSP reports for blocked 'data:' URLs should report the scheme only.
Summary: CSP reports for blocked 'data:' URLs should report the scheme only.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mike West
URL:
Keywords:
Depends on:
Blocks: 85558
  Show dependency treegraph
 
Reported: 2013-02-11 06:59 PST by Mike West
Modified: 2013-02-11 13:31 PST (History)
3 users (show)

See Also:


Attachments
Patch (4.95 KB, patch)
2013-02-11 07:13 PST, Mike West
no flags Details | Formatted Diff | Diff
Patch (5.65 KB, patch)
2013-02-11 11:29 PST, Mike West
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike West 2013-02-11 06:59:20 PST
https://dvcs.w3.org/hg/content-security-policy/rev/001dc8e8bcc3 changed the CSP 1.1 spec to require that blocked URLs that don't map well to the web (e.g. 'data:', 'javascript:', etc.) be stripped down to their scheme in violation reports. I'm not sure what the best way to do that actually is... The question sorta maps to 'KURL::isHierarchical()', but not really. The current patch uses 'KURL::canSetHostOrPort()' (which maps to 'isHierarchical()'), but there's likely a better way.

Adam, what do you think?
Comment 1 Mike West 2013-02-11 07:13:03 PST
Created attachment 187566 [details]
Patch
Comment 2 Adam Barth 2013-02-11 10:38:08 PST
Comment on attachment 187566 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=187566&action=review

> Source/WebCore/page/ContentSecurityPolicy.cpp:1634
> +        if (blockedURL.canSetHostOrPort())

I'd use isHierarchical rather than canSetHostOrPort, but I think they're the same.
Comment 3 Mike West 2013-02-11 11:18:07 PST
(In reply to comment #2)
> (From update of attachment 187566 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=187566&action=review
> 
> > Source/WebCore/page/ContentSecurityPolicy.cpp:1634
> > +        if (blockedURL.canSetHostOrPort())
> 
> I'd use isHierarchical rather than canSetHostOrPort, but I think they're the same.

KURL::isHierarchical is private, which is why I used this (which, as you say, is simply an alias). Should I move it out into the public API?
Comment 4 Adam Barth 2013-02-11 11:20:11 PST
SUre.
Comment 5 Mike West 2013-02-11 11:29:21 PST
Created attachment 187628 [details]
Patch
Comment 6 Mike West 2013-02-11 11:30:25 PST
Comment on attachment 187628 [details]
Patch

Whoops. Carrying over Adam's r+. Meant to just throw this at the bots before CQing.
Comment 7 WebKit Review Bot 2013-02-11 13:31:24 PST
Comment on attachment 187628 [details]
Patch

Clearing flags on attachment: 187628

Committed r142506: <http://trac.webkit.org/changeset/142506>
Comment 8 WebKit Review Bot 2013-02-11 13:31:28 PST
All reviewed patches have been landed.  Closing bug.