<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>22752</bug_id>
          
          <creation_ts>2013-07-22 10:52:57 +0000</creation_ts>
          <short_desc>[imports]: Imports should respect CSP</short_desc>
          <delta_ts>2013-09-13 07:51:31 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>20683</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Morrita Hajime">morrita</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>w3c</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>91067</commentid>
    <comment_count>0</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2013-07-22 10:52:57 +0000</bug_when>
    <thetext>Import should beware Content Security Policy [1]

There are at least two questions to adopt CSP for HTML Improts:

- Q1: Which directive should it follow or should it have its own directive?
- Q2: Which document should sub-imports restricted?
      The master, or the parent?

For Q1:
It should be script-src. It runs script and it isn&apos;t rendered.
Having its own directive could be an option. but I don&apos;t come up with
a valid scenario where the author wants such one.

For Q2:
It should follow master&apos;s policy, not parent&apos;s
This is because the script runs on the master&apos;s scripting context.


[1] http://www.w3.org/TR/CSP/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91264</commentid>
    <comment_count>1</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2013-07-25 00:33:57 +0000</bug_when>
    <thetext>As discussed at https://codereview.chromium.org/19940002/,

&gt; For Q2:
&gt; It should follow master&apos;s policy, not parent&apos;s
&gt; This is because the script runs on the master&apos;s scripting context.

I was convinced that Each import should respect its own CSP, rather than one of the master.
The rationale is that:

- It is confusing when the document behaves differently when
  it is loaded as import and it is loaded as usual (as a frame).
  Such parity should be minimized.
- If the master want protect itself, it should just block imports being loaded.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>91303</commentid>
    <comment_count>2</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2013-07-26 05:18:17 +0000</bug_when>
    <thetext>Noticed that it&apos;s hard to enforce non-eval() policy
because imports share its context with the master.

V8/Blink doesn&apos;t have mechanism to switch allow/disallow eval
per script evaluation. Also, it&apos;s hard to track the call site 
if we call eval in some callbacks.

In practice though, this won&apos;t be a problem because
apps/sites which want to prohibit eval() in imports will want to prohibit eval()
in its own context. 

So question here is whether we should explicitly exclude eval() blocking
or leave it as an implementation limitation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93330</commentid>
    <comment_count>3</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2013-09-13 07:20:18 +0000</bug_when>
    <thetext>CSP1.1 has HTML Imports built-in
https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html#script-src</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93331</commentid>
    <comment_count>4</comment_count>
    <who name="Morrita Hajime">morrita</who>
    <bug_when>2013-09-13 07:51:31 +0000</bug_when>
    <thetext>https://dvcs.w3.org/hg/webcomponents/rev/fe810409723a</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>