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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>113122</bug_id>
          
          <creation_ts>2013-03-22 17:44:22 -0700</creation_ts>
          <short_desc>Honor the setting for whether JavaScript markup is enabled</short_desc>
          <delta_ts>2013-03-27 20:23:15 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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>
          <dependson>112999</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Geoffrey Garen">ggaren</reporter>
          <assigned_to name="Geoffrey Garen">ggaren</assigned_to>
          <cc>abarth</cc>
    
    <cc>dbates</cc>
    
    <cc>dcheng</cc>
    
    <cc>enrica</cc>
    
    <cc>eric</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>esprehn</cc>
    
    <cc>inferno</cc>
    
    <cc>mjs</cc>
    
    <cc>ojan.autocc</cc>
    
    <cc>rniwa</cc>
    
    <cc>sam</cc>
    
    <cc>tony</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>862032</commentid>
    <comment_count>0</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-22 17:44:22 -0700</bug_when>
    <thetext>Honor the setting for whether JavaScript markup is enabled</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862047</commentid>
    <comment_count>1</comment_count>
      <attachid>194673</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-22 18:04:22 -0700</bug_when>
    <thetext>Created attachment 194673
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862156</commentid>
    <comment_count>2</comment_count>
      <attachid>194673</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-22 23:07:53 -0700</bug_when>
    <thetext>Comment on attachment 194673
Patch

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

Looks good but maybe eseidel or abarth can comment on the HTMLConstructionSite and HTMLTreeBuilder changes.

&gt; LayoutTests/editing/unsupported-content/script-markup-enabled-setting-expected.txt:4
&gt; +PASS: frames[0].document.getElementsByTagName(&quot;script&quot;).length should be 0 and is.
&gt; +PASS: frames[1].document.getElementsByTagName(&quot;script&quot;).length should be 0 and is.

These output doesn&apos;t tell us what each line is testing. Why don&apos;t we give frames some descriptive ids such as
frameWithHTMLScriptElement and frameWithSVGScriptElement so that the output is self-evident.

&gt; LayoutTests/editing/unsupported-content/script-markup-enabled-setting.html:10
&gt; +function shouldBe(aDescription, a, b)

Why don&apos;t we just use js-test-pre.js?

&gt; LayoutTests/editing/unsupported-content/script-markup-enabled-setting.html:14
&gt; +		log(&quot;PASS: &quot; + aDescription + &quot; should be &quot; + b + &quot; and is.&quot;);
&gt; +		return;

Nit: tab characters.

&gt; LayoutTests/editing/unsupported-content/script-markup-enabled-setting.html:24
&gt; +if (window.testRunner)
&gt; +	testRunner.dumpAsText();
&gt; +
&gt; +if (window.internals)
&gt; +    window.internals.settings.setScriptMarkupEnabled(false);

These two if&apos;s can be combined.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862200</commentid>
    <comment_count>3</comment_count>
      <attachid>194705</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-23 09:09:20 -0700</bug_when>
    <thetext>Created attachment 194705
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862202</commentid>
    <comment_count>4</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-23 09:11:52 -0700</bug_when>
    <thetext>&gt; These output doesn&apos;t tell us what each line is testing. Why don&apos;t we give frames some descriptive ids such as
&gt; frameWithHTMLScriptElement and frameWithSVGScriptElement so that the output is self-evident.

Fixed.

&gt; Why don&apos;t we just use js-test-pre.js?

I think js-test-pre.js is an anti-pattern. It has two major problems:

(1) Everything executes through eval. This makes testing specific JavaScript details impossible.

(2) It&apos;s a huge pile of code. The purpose of a reduced test case is to be the opposite. The first thing I always have to do when I diagnose a test failure in a test that uses js-test-pre.js is to make a reduction of the test. We shouldn&apos;t have to make reductions of our reduced test cases!

&gt; Nit: tab characters.

Fixed.

&gt; These two if&apos;s can be combined.

Fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862231</commentid>
    <comment_count>5</comment_count>
      <attachid>194705</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-03-23 11:53:03 -0700</bug_when>
    <thetext>Comment on attachment 194705
Patch

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

Is this a setting only for WebKit embedders?  Only on Mac?  If so, it seems we should consider wrapping this in #ifdef MAC

&gt; Source/WebCore/html/parser/HTMLConstructionSite.cpp:466
&gt; +    if (scriptingContentIsAllowed(m_parserContentPolicy) || !toScriptElement(element.get()))
&gt; +        attachLater(currentNode(), element, token-&gt;selfClosing());

So the goal here is to drop the &lt;script&gt; tag on the floor when scripting content is disallowed?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862237</commentid>
    <comment_count>6</comment_count>
      <attachid>194705</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-03-23 12:28:50 -0700</bug_when>
    <thetext>Comment on attachment 194705
Patch

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

&gt; Source/WebCore/ChangeLog:20
&gt; +        (This bug has existed for copy/paste for a long time, but other bugs and
&gt; +        quirks in SVG copy/paste papered over it. It&apos;s a serious issue now
&gt; +        that non-paste clients will rely on this mode.)

Could you talk a bit about what clients, and if these include browsers/the-web?

The idea of running the parser in a mode whereby it will not produce certain tags seems reasonable.  I&apos;m not 100% convinced the parser wants the complexity, and that this is the right solution for your needs.  But we already do something a bit similar for the XSSAuditor, but that&apos;s for attributes (it produces, them but them empties them in a follow-up pass).

It&apos;s a little unfortunate that the parser has to know any of this, since it&apos;s job is really just to produce a DOM.  The TreeBuidler passes each sript over to the HTMLScriptRunner, which actually knows what to do with the script.  It doesn&apos;t currently modify script contents, but might be reasonable to make the HTMLScriptRunner instead just null out the innerHTML of the passed script tag.

&gt;&gt; Source/WebCore/html/parser/HTMLConstructionSite.cpp:466
&gt;&gt; +        attachLater(currentNode(), element, token-&gt;selfClosing());
&gt; 
&gt; So the goal here is to drop the &lt;script&gt; tag on the floor when scripting content is disallowed?

Maybe the ScriptRunner should do this instead of the construction site?  The construction site is a pretty low level primative.

&gt; Source/WebCore/html/parser/HTMLTreeBuilder.cpp:2872
&gt; +            if (scriptingContentIsAllowed(m_tree.parserContentPolicy()))
&gt; +                m_scriptToProcess = m_tree.currentElement();

I think teaching the HTMLScriptRunner about this instead of the parser would make it easier to make sure you don&apos;t miss some later script tag.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862238</commentid>
    <comment_count>7</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2013-03-23 12:33:43 -0700</bug_when>
    <thetext>I guess I find it hard to engage about this change.  There was an off-on-the-wrong-foot webkit-dev thread about this change.  I feel like I&apos;m not really needed here, as I get the sense there is time-pressure for this change, and you don&apos;t need my approval to twiddle bits on your own servers. :)

My limited understanding is that you&apos;re trying to fix potential security bugs in Mail.  Which seems like a reasonable desire.  I&apos;m not sure this is the right place to fix the behavior.  I wonder how gmail strips script tags. :)  Presumably not in WebKit.

I&apos;m happy to offer further thoughts, but it may be easier for all involved if I just de-CC myself and live a happier life.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862243</commentid>
    <comment_count>8</comment_count>
      <attachid>194705</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-23 12:52:52 -0700</bug_when>
    <thetext>Comment on attachment 194705
Patch

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

&gt;&gt;&gt; Source/WebCore/html/parser/HTMLConstructionSite.cpp:466
&gt;&gt;&gt; +        attachLater(currentNode(), element, token-&gt;selfClosing());
&gt;&gt; 
&gt;&gt; So the goal here is to drop the &lt;script&gt; tag on the floor when scripting content is disallowed?
&gt; 
&gt; Maybe the ScriptRunner should do this instead of the construction site?  The construction site is a pretty low level primative.

HTMLConstructionSite::insertScriptElement, which is the function that appears right above this one, does this check already.

But unifying these scriptingContentIsAllowed checks at one place like ScriptRunner makes a lot of sense since they&apos;re scattered
across HTML &amp; XML parsers at the moment. Perhaps we should do it in a separate patch?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862245</commentid>
    <comment_count>9</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-23 12:56:36 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; I guess I find it hard to engage about this change.  There was an off-on-the-wrong-foot webkit-dev thread about this change.  I feel like I&apos;m not really needed here, as I get the sense there is time-pressure for this change, and you don&apos;t need my approval to twiddle bits on your own servers. :)

My understanding is that this patch is nothing to do with that webkit-dev thread. That one was a discussion about implementing CSP or features like CSP by stripping scripts at parsing time.

This patch is about fixing an existing feature in WebKit so that other applications such as Mail can use it as we&apos;ve exposed it via settings in the bug 112999.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862248</commentid>
    <comment_count>10</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-23 13:00:00 -0700</bug_when>
    <thetext>I&apos;ll note that the &quot;existing feature&quot; is stripping scripting contents when pasting contents from clipboard.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862249</commentid>
    <comment_count>11</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-23 13:02:30 -0700</bug_when>
    <thetext>I&apos;ll further note that this is about fixing a bug that already exists for pasting from clipboard case. For whatever reason, we could not come up with a reduction for erroneously executing scripts when pasting from clipboard because of some bug in editing code or parsing SVG (Geoff would know).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862253</commentid>
    <comment_count>12</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-23 13:28:07 -0700</bug_when>
    <thetext>&gt; Is this a setting only for WebKit embedders?  Only on Mac?  If so, it seems we should consider wrapping this in #ifdef MAC

This is a setting that&apos;s appropriate for mail, newsfeed, and chat apps, which digest markup but don&apos;t want to risk script injection attacks. I don&apos;t think there&apos;s anything special about Mac apps that make them want protection from script injection any more than Linux or Windows apps. Do you?

A side-benefit of this setting is that it allows us to regression test WebKit&apos;s copy/paste and drag/drop script injection protection without going through contortions in the test to copy the content and then paste it. For example, that&apos;s how I discovered the SVG script injection bug, even though it can&apos;t be reproduced by a copy operation in WebKit. I don&apos;t think WebKit wants less regression testing on Linux or Windows than on Mac. Do you?

&gt; So the goal here is to drop the &lt;script&gt; tag on the floor when scripting content is disallowed?

That&apos;s right: We want to parse exactly &quot;as if&quot; the tag had been there, obeying whatever effect it would have had on the tag soup, without ever executing it or inserting it into the DOM.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862254</commentid>
    <comment_count>13</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-23 14:03:29 -0700</bug_when>
    <thetext>&gt; Could you talk a bit about what clients, and if these include browsers/the-web?

The parsing feature -- stripping scripts to avoid script injection attacks -- is used by browsers when executing paste and drop commands. See our regression tests in LayoutTests/editing/pasteboard for some examples. WebKit browsers have worked this way since 2010. The bug fix in this feature -- the one for SVG scripts -- is intended for all WebKit clients, including browsers.

The setting, which allows a client to opt into script injection protection all the time, instead of just when pasting or dropping, is intended for mail, newsfeed, and chat apps, which digest markup but don&apos;t want to risk script injection attacks.

&gt; The idea of running the parser in a mode whereby it will not produce certain tags seems reasonable.
&gt; I&apos;m not 100% convinced the parser wants the complexity, and that this is the right solution for your needs.

I want to clarify that the parser has had this feature since 2010, in order to solve a general problem in WebKit. If there&apos;s a better way to do things, let&apos;s do it, and make WebKit better.

&gt; It&apos;s a little unfortunate that the parser has to know any of this, since it&apos;s job is really just to produce a DOM.

I might be upside-down about this, but that&apos;s actually why I chose the parser: The goal of the feature is to change the generated DOM, by eliminating tags and attributes that map to scripts at runtime.

The reason we want to remove these from the DOM is that down the line, after parsing, we don&apos;t want an editing operation, or a DOM clone or move operation, to accidentally inject that script-y DOM, thereby allowing it to execute.

&gt;  The TreeBuidler passes each sript over to the HTMLScriptRunner, which actually knows what to do with the script.  It doesn&apos;t currently modify script contents, but might be reasonable to make the HTMLScriptRunner instead just null out the innerHTML of the passed script tag.

I have to admit that I tried a bunch of different options before I settled on the parser, so I won&apos;t argue that the current solution is self-evident. The HTMLScriptRunner appealed to me at one point, but I ran into two challenges:

(1) It&apos;s a little insecure to leave even an empty script element in the DOM. If an editing operation accidentally inserted text into that element&apos;s text content, it could execute as script. I tried to improve this by just having the script runner remove the whole element from its parent, but that sometimes happens at an inconvenient time for the parser&apos;s state machine, causing crashes.

(2) The HTMLScriptRunner doesn&apos;t control script-y attributes getting added to DOM nodes. Once I decided that the parser had to be in charge of the attributes part of this feature, it seemed natural to keep responsibility for the elements part of this feature in the same place.

(3) When parsing document fragments (paste and drop commands), there is no HTMLScriptRunner.

Given these challenges, do you still think the HTMLScriptRunner is the best place to do this? How would you address these issues?

&gt; &gt; Source/WebCore/html/parser/HTMLTreeBuilder.cpp:2872
&gt; &gt; +            if (scriptingContentIsAllowed(m_tree.parserContentPolicy()))
&gt; &gt; +                m_scriptToProcess = m_tree.currentElement();
&gt; 
&gt; I think teaching the HTMLScriptRunner about this instead of the parser would make it easier to make sure you don&apos;t miss some later script tag.

I share this concern. 

I wonder if there&apos;s a reasonable belt-and-suspenders approach here, that takes advantage of HTMLScriptRunner being a bottleneck for script execution at parse time. For example, we could arrange for HTMLScriptRunner to always be NULL if script markup is disabled, instead of only when parsing document fragments, or we could add a RELEASE_ASSERT to HTMLScriptRunner. What do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862256</commentid>
    <comment_count>14</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-23 14:23:17 -0700</bug_when>
    <thetext>(In reply to comment #9)
&gt; My understanding is that this patch is nothing to do with that webkit-dev thread.

This is a bit of an overstatement.

I started the webkit-dev thread because Maciej convinced me that stripping script markup was more secure than leaving it in the DOM, and it occurred to me that it would be a security improvement, and a reduction in complexity, to use this technique in all cases where WebKit wanted to disable scripts, instead of just these two or three cases.

So, this patch is related because it motivated me to start that discussion.

However, Jochen Eisinger pointed out that we can&apos;t use a single technique everywhere because Chromium&apos;s script blocking UI requires special hooks in WebKit. And Adam Barth pointed out that we can&apos;t use a single technique everywhere because the more secure technique is incompatible with the current draft spec for CSP.

So, now this patch returns to its humble roots, and fixes the original bug I intended to fix, without making any broader changes in WebKit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862258</commentid>
    <comment_count>15</comment_count>
      <attachid>194719</attachid>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-23 15:06:26 -0700</bug_when>
    <thetext>Created attachment 194719
Attempt to create a reduction with copy &amp; paste

There appears to be some other mechanism by which we&apos;re stripping script content.

Maybe inferno and others in the security team can help us making an actual reduction for this case.
I&apos;ve started to wonder if this bug should be moved to the security component or not but I guess
we can wait &apos;til we get an actual reduction?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862259</commentid>
    <comment_count>16</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-23 15:08:44 -0700</bug_when>
    <thetext>+dcheng &amp; +tony^work since they&apos;ve worked on the clipboardData/dataTransfer code recently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862294</commentid>
    <comment_count>17</comment_count>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2013-03-23 19:42:32 -0700</bug_when>
    <thetext>(In reply to comment #13)
&gt;...
&gt; 
&gt; I have to admit that I tried a bunch of different options before I settled on the parser, so I won&apos;t argue that the current solution is self-evident. The HTMLScriptRunner appealed to me at one point, but I ran into two challenges:
&gt; 
&gt; (1) It&apos;s a little insecure to leave even an empty script element in the DOM. If an editing operation accidentally inserted text into that element&apos;s text content, it could execute as script. I tried to improve this by just having the script runner remove the whole element from its parent, but that sometimes happens at an inconvenient time for the parser&apos;s state machine, causing crashes.
&gt; 

This is definitely not the case. A script element can only run once, per the &quot;already started&quot; flag, as specified in the HTML5 spec.

http://www.w3.org/html/wg/drafts/html/master/scripting-1.html#prepare-a-script

This flag even persists through cloning.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862318</commentid>
    <comment_count>18</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2013-03-23 22:50:28 -0700</bug_when>
    <thetext>(In reply to comment #17)
&gt; (In reply to comment #13)
&gt; &gt;...
&gt; &gt; 
&gt; &gt; I have to admit that I tried a bunch of different options before I settled on the parser, so I won&apos;t argue that the current solution is self-evident. The HTMLScriptRunner appealed to me at one point, but I ran into two challenges:
&gt; &gt; 
&gt; &gt; (1) It&apos;s a little insecure to leave even an empty script element in the DOM. If an editing operation accidentally inserted text into that element&apos;s text content, it could execute as script. I tried to improve this by just having the script runner remove the whole element from its parent, but that sometimes happens at an inconvenient time for the parser&apos;s state machine, causing crashes.
&gt; &gt; 
&gt; 
&gt; This is definitely not the case. A script element can only run once, per the &quot;already started&quot; flag, as specified in the HTML5 spec.
&gt; 
&gt; http://www.w3.org/html/wg/drafts/html/master/scripting-1.html#prepare-a-script
&gt; 
&gt; This flag even persists through cloning.

It doesn&apos;t persist through serializing/deserializing though, so if you accidentally put text in a &lt;script&gt;, it&apos;s no longer safe to copy/paste the content containing it. Or if you remove and reinsert this script by assigning its parents innerHTML to itself.

In any case, since stripping scripting constructs at parse time is an existing WebKit feature, and this patch just exposes it for a new use, proposals for how to change the way we strip scripting constructs maybe should go in another bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862321</commentid>
    <comment_count>19</comment_count>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2013-03-23 23:15:44 -0700</bug_when>
    <thetext>(In reply to comment #18)
&gt; ...
&gt; &gt; This is definitely not the case. A script element can only run once, per the &quot;already started&quot; flag, as specified in the HTML5 spec.
&gt; &gt; 
&gt; &gt; http://www.w3.org/html/wg/drafts/html/master/scripting-1.html#prepare-a-script
&gt; &gt; 
&gt; &gt; This flag even persists through cloning.
&gt; 
&gt; It doesn&apos;t persist through serializing/deserializing though, so if you accidentally put text in a &lt;script&gt;, it&apos;s no longer safe to copy/paste the content containing it. Or if you remove and reinsert this script by assigning its parents innerHTML to itself.
&gt; 

Scripts inserted through innerHTML never run. It&apos;s not clear to me why we don&apos;t just drop the text from inside script elements and attributes in the deserializer (or just disable all inline script like CSP).

&gt; In any case, since stripping scripting constructs at parse time is an existing WebKit feature, and this patch just exposes it for a new use, proposals for how to change the way we strip scripting constructs maybe should go in another bug.

I really don&apos;t think this is the right way to fix the issue for desktop apps, but it&apos;s important to note that doing this on the open web can, and does, break pages:

&lt;script&gt;&lt;/script&gt;
&lt;span&gt;...&lt;/span&gt;
&lt;style&gt;script + div { color: red; }&lt;/script&gt;

or even more common:

&lt;div&gt;
  &lt;script&gt;&lt;/script&gt;
  &lt;span&gt;...&lt;/span&gt;
&lt;/div&gt;

&lt;style&gt;div:nth-child(2) { color: red; }&lt;/style&gt;

Why doesn&apos;t Mail or Adium just use CSP though, or a sandboxed iframe that doesn&apos;t allow scripts?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862331</commentid>
    <comment_count>20</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-24 00:56:44 -0700</bug_when>
    <thetext>(In reply to comment #18)
&gt; (In reply to comment #17)
&gt; &gt;
&gt; &gt; This is definitely not the case. A script element can only run once, per the &quot;already started&quot; flag, as specified in the HTML5 spec.
&gt; &gt; 
&gt; &gt; http://www.w3.org/html/wg/drafts/html/master/scripting-1.html#prepare-a-script
&gt; &gt; 
&gt; &gt; This flag even persists through cloning.
&gt; 
&gt; It doesn&apos;t persist through serializing/deserializing though, so if you accidentally put text in a &lt;script&gt;, it&apos;s no longer safe to copy/paste the content containing it.

It is. Our paste code disables script elements.

&gt; Or if you remove and reinsert this script by assigning its parents innerHTML to itself.

Apparently we don&apos;t do this. setInnerHTML strips the script element&apos;s content so the script element doesn&apos;t do anything.

(In reply to comment #19)
&gt; It&apos;s not clear to me why we don&apos;t just drop the text from inside script elements and attributes in the deserializer (or just disable all inline script like CSP).

We do do that.

&gt; &gt; In any case, since stripping scripting constructs at parse time is an existing WebKit feature, and this patch just exposes it for a new use, proposals for how to change the way we strip scripting constructs maybe should go in another bug.
&gt; 
&gt; I really don&apos;t think this is the right way to fix the issue for desktop apps, but it&apos;s important to note that doing this on the open web can, and does, break pages:
&gt; 
&gt; &lt;script&gt;&lt;/script&gt;
&gt; &lt;span&gt;...&lt;/span&gt;
&gt; &lt;style&gt;script + div { color: red; }&lt;/script&gt;
&gt; 
&gt; or even more common:
&gt; 
&gt; &lt;div&gt;
&gt;   &lt;script&gt;&lt;/script&gt;
&gt;   &lt;span&gt;...&lt;/span&gt;
&gt; &lt;/div&gt;
&gt; 
&gt; &lt;style&gt;div:nth-child(2) { color: red; }&lt;/style&gt;

That&apos;s a very good point. This will indeed be a problem for Mail.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862339</commentid>
    <comment_count>21</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2013-03-24 03:44:54 -0700</bug_when>
    <thetext>(In reply to comment #20)
&gt; &gt; 
&gt; &gt; I really don&apos;t think this is the right way to fix the issue for desktop apps, but it&apos;s important to note that doing this on the open web can, and does, break pages:
&gt; &gt; 
&gt; &gt; &lt;script&gt;&lt;/script&gt;
&gt; &gt; &lt;span&gt;...&lt;/span&gt;
&gt; &gt; &lt;style&gt;script + div { color: red; }&lt;/script&gt;
&gt; &gt; 
&gt; &gt; or even more common:
&gt; &gt; 
&gt; &gt; &lt;div&gt;
&gt; &gt;   &lt;script&gt;&lt;/script&gt;
&gt; &gt;   &lt;span&gt;...&lt;/span&gt;
&gt; &gt; &lt;/div&gt;
&gt; &gt; 
&gt; &gt; &lt;style&gt;div:nth-child(2) { color: red; }&lt;/style&gt;
&gt; 
&gt; That&apos;s a very good point. This will indeed be a problem for Mail.

As a point of comparison, in GMail and MobileMe Mail (I cold not get YahooMail to work) both strip red from minimally corrected versions of the above snippets. Is such a construct actually involving the presence of scripts common on the web? Evidence seems to be that it&apos;s not common enough that mail clients care more about it than about stripping script tags.

 - Maciej

&lt;div&gt;...&lt;/div&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862398</commentid>
    <comment_count>22</comment_count>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2013-03-24 12:21:31 -0700</bug_when>
    <thetext>(In reply to comment #21)
&gt; ...
&gt; &gt; 
&gt; &gt; That&apos;s a very good point. This will indeed be a problem for Mail.
&gt; 
&gt; As a point of comparison, in GMail and MobileMe Mail (I cold not get YahooMail to work) both strip red from minimally corrected versions of the above snippets. Is such a construct actually involving the presence of scripts common on the web? Evidence seems to be that it&apos;s not common enough that mail clients care more about it than about stripping script tags.
&gt; 
&gt;  - Maciej
&gt; 
&gt; &lt;div&gt;...&lt;/div&gt;

Outlook 2007+ has such crippled CSS support that I don&apos;t know if people depend on that much. I have seen some internal apps at Google break when Google Feedback&apos;s page copier which is used to make an inert copy of a page removed script tags though.

rniwa and I have debunked the theoretical exploits here: innerHTML never runs scripts, editing drops the contents of scripts on paste, scripts never run more than once in the document.

I don&apos;t understand what this patch is attempting to solve, nor is it clear why Mail isn&apos;t using a sandboxed iframe if you were really paranoid that all the protections we already have are not enough.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862401</commentid>
    <comment_count>23</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-24 12:29:50 -0700</bug_when>
    <thetext>We can&apos;t always use sandboxed iframe for this feature because some OS X applications inject scripts into the document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862418</commentid>
    <comment_count>24</comment_count>
      <attachid>194769</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-24 15:08:30 -0700</bug_when>
    <thetext>Created attachment 194769
Script injection attack examples

Test case showing some script injection attacks, and how CSP and other mechanisms do not protect against them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862423</commentid>
    <comment_count>25</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-24 15:21:02 -0700</bug_when>
    <thetext>&gt; A script element can only run once, per the &quot;already started&quot; flag, as specified in the HTML5 spec.

As Maciej mentioned, the already started flag does not protect against serialization / deserialization attacks. See the attached test case.

&gt; Why doesn&apos;t Mail or Adium just use CSP though, or a sandboxed iframe that doesn&apos;t allow scripts?

(1) CSP blocks user/host-injected JavaScript, which breaks apps that implement features in JavaScript.

(2) CSP is subject to script injection attacks. See the attached test case.

&gt; doing this on the open web can, and does, break pages

It sounds like you&apos;re objecting to WebKit&apos;s existing behavior for paste and drop.  I would be surprised if it broke the web, since we haven&apos;t gotten any bug reports about it over the past three years. That said, the specifics of how we should handle paste and drop are not really germane to this bug, which just exposes WebKit&apos;s paste/drop protection as a setting for native apps.

&gt; I have seen some internal apps at Google break when Google Feedback&apos;s page copier which is used to make an inert copy of a page removed script tags though.

Fair enough. But that&apos;s not the open web. Maciej&apos;s examples seem to indicate that the de fact standard on the open web is for mail clients to wholly strip script elements. Do you have any examples of web-based mail clients that leave script elements in the document?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862431</commentid>
    <comment_count>26</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-24 15:58:19 -0700</bug_when>
    <thetext>(In reply to comment #25)
&gt;
&gt; &gt; doing this on the open web can, and does, break pages
&gt; 
&gt; It sounds like you&apos;re objecting to WebKit&apos;s existing behavior for paste and drop.  I would be surprised if it broke the web, since we haven&apos;t gotten any bug reports about it over the past three years. That said, the specifics of how we should handle paste and drop are not really germane to this bug, which just exposes WebKit&apos;s paste/drop protection as a setting for native apps.

It&apos;s probably safer to strip the contents of the script element and leave empty script elements alone just like what we do in setInnerHTML than removing the script elements entirely per Elliot&apos;s examples.

On the other hand, editing code is almost completely broken for cases where we have such style rules so I&apos;m not certain if it&apos;s something we should really be concerned about.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862924</commentid>
    <comment_count>27</comment_count>
      <attachid>194891</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-25 11:11:01 -0700</bug_when>
    <thetext>Created attachment 194891
Specific demonstration of why an empty script element is dangerous</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>862929</commentid>
    <comment_count>28</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-25 11:19:03 -0700</bug_when>
    <thetext>&gt; It&apos;s probably safer to strip the contents of the script element and leave empty script elements alone just like what we do in setInnerHTML than removing the script elements entirely per Elliot&apos;s examples.

I&apos;ve attached an additional test case demonstrating the specific attack an empty script element opens our users up to.

Which approach is more compatible with the web all depends on what other mail, chat, etc. content viewers do on the web. So far, we have two examples of mail content viewers that strip the script element, and zero examples of mail content viewers that preserve it. The evidence says that stripping the script element is both more secure and more compatible.

All of that being said, I&apos;ll repeat: This patch just exposes WebKit&apos;s existing behavior as a setting, and fixes an oversight that prevented that behavior from covering svg script elements. This patch did not invent the behavior, and ideas for changing the behavior are not germane to this patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>864800</commentid>
    <comment_count>29</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-27 13:07:38 -0700</bug_when>
    <thetext>Ryosuke mentioned that some Google engineers said on IRC that they thought stripping scripts from emails was something unique to Apple Mail. Let me re-re-state: GMail does it too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>864804</commentid>
    <comment_count>30</comment_count>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2013-03-27 13:12:48 -0700</bug_when>
    <thetext>(In reply to comment #29)
&gt; Ryosuke mentioned that some Google engineers said on IRC that they thought stripping scripts from emails was something unique to Apple Mail. Let me re-re-state: GMail does it too.

That&apos;s not what I said. I said that the examples given here are effectively eval() and that the whole argument of this bug is that Apple&apos;s Mail.app engineers are apparently incapable of writing safe JS so we need to protect them at the platform level. Making every nested iframe CSP, or having Mail.app put the sandbox attribute on every nested iframe, and CSP at the top level (which seems totally reasonable) also fixes this bug.

I can&apos;t fathom a reason that Mail.app would put the HTML contents of an email into anything _but_ a sandboxed iframe. :)

Anyway, I don&apos;t want to block this patch, but I do object to claiming that Adium needs to turn this feature on to be safe. They can be just as safe by using CSP and sandbox and not have the surprising parser magic, and indeed this is what Chrome OS does to be secure.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>864815</commentid>
    <comment_count>31</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-27 13:28:54 -0700</bug_when>
    <thetext>&gt; Making every nested iframe CSP, or having Mail.app put the sandbox attribute on every nested iframe, and CSP at the top level (which seems totally reasonable) also fixes this bug.

I guess you didn&apos;t notice my comments above, where I explained why that wouldn&apos;t work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>864820</commentid>
    <comment_count>32</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-27 13:33:46 -0700</bug_when>
    <thetext>Give that Gmail also strips script elements, the point Elliot made against this approach that some CSS rules may apply differently is now an argument for this approach. If we didn&apos;t strip the script element, Maill will render an email differently than on Gmail.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>864825</commentid>
    <comment_count>33</comment_count>
    <who name="Elliott Sprehn">esprehn</who>
    <bug_when>2013-03-27 13:37:44 -0700</bug_when>
    <thetext>(In reply to comment #32)
&gt; Give that Gmail also strips script elements, the point Elliot made against this approach that some CSS rules may apply differently is now an argument for this approach. If we didn&apos;t strip the script element, Maill will render an email differently than on Gmail.

Seems reasonable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>864829</commentid>
    <comment_count>34</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-27 13:42:32 -0700</bug_when>
    <thetext>I&apos;ll also note that clipboard API working draft has HTML paste sanitation algorithm (http://www.w3.org/TR/clipboard-apis/#cross-origin-html-paste-sanitization-algorithm). This algorithm has been removed from the latest editor&apos;s draft due to lack of implementations but our behavior matches this algorithm&apos;s behavior at least for script element and on* attributes.

I&apos;ve emailed public-webapps to define what UAs are allowed to address security concerns so that, specifically, things like CSS rules dependent on script element being present in the pasted content won&apos;t be an issue for us.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>864978</commentid>
    <comment_count>35</comment_count>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2013-03-27 16:43:17 -0700</bug_when>
    <thetext>Committed r147018: &lt;http://trac.webkit.org/changeset/147018&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>865025</commentid>
    <comment_count>36</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2013-03-27 17:14:07 -0700</bug_when>
    <thetext>(In reply to comment #32)
&gt; Give that Gmail also strips script elements, the point Elliot made against this approach that some CSS rules may apply differently is now an argument for this approach. If we didn&apos;t strip the script element, Maill will render an email differently than on Gmail.

I did more testing - in addition to Gmail, the following all completely strip scripts in mail messages: iCloud Mail, YahooMail, Microsoft Live Mail.

None of these appear to put HTML emails in a sandboxed iframe, nor do they appear to use CSP, even on browsers that support these features.

As others have concluded, it&apos;s probably better for Mail.app to be compatible with popular webmail clients than to do something different and more complicated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>865130</commentid>
    <comment_count>37</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-03-27 20:23:15 -0700</bug_when>
    <thetext>Debug tester fixed in http://trac.webkit.org/changeset/147050.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>194673</attachid>
            <date>2013-03-22 18:04:22 -0700</date>
            <delta_ts>2013-03-23 09:09:15 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-113122-20130322180009.patch</filename>
            <type>text/plain</type>
            <size>6891</size>
            <attacher name="Geoffrey Garen">ggaren</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDE0NjY5MikKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDMyIEBACisyMDEzLTAzLTIyICBHZW9mZnJl
eSBHYXJlbiAgPGdnYXJlbkBhcHBsZS5jb20+CisKKyAgICAgICAgSG9ub3IgdGhlIHNldHRpbmcg
Zm9yIHdoZXRoZXIgSmF2YVNjcmlwdCBtYXJrdXAgaXMgZW5hYmxlZAorICAgICAgICBodHRwczov
L2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTEzMTIyCisKKyAgICAgICAgUmV2aWV3
ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgKiBkb20vU2NyaXB0YWJsZURvY3VtZW50
UGFyc2VyLmNwcDoKKyAgICAgICAgKFdlYkNvcmU6OlNjcmlwdGFibGVEb2N1bWVudFBhcnNlcjo6
U2NyaXB0YWJsZURvY3VtZW50UG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b3cudGVzdFJ1bm5lcikKKwl0ZXN0UnVubmVyLmR1bXBBc1RleHQoKTsKKworaWYg
KHdpbmRvdy5pbnRlcm5hbHMpCisgICAgd2luZG93LmludGVybmFscy5zZXR0aW5ncy5zZXRTY3Jp
cHRNYXJrdXBFbmFibGVkKGZhbHNlKTsKK2Vsc2UKKyAgICBsb2coIlRoaXMgdGVzdCBkZXBlbmRz
IG9uIHRoZSBKYXZhU2NyaXB0TWFya3VwRW5hYmxlZCBzZXR0aW5nIGJlaW5nIGZhbHNlLiIpOwor
Cit3aW5kb3cub25sb2FkID0gZnVuY3Rpb24gdGVzdCgpCit7CisJc2hvdWxkQmUoJ2ZyYW1lc1sw
XS5kb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgic2NyaXB0IikubGVuZ3RoJywgZnJhbWVz
WzBdLmRvY3VtZW50LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJzY3JpcHQiKS5sZW5ndGgsIDApOwor
CXNob3VsZEJlKCdmcmFtZXNbMV0uZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoInNjcmlw
dCIpLmxlbmd0aCcsIGZyYW1lc1sxXS5kb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgic2Ny
aXB0IikubGVuZ3RoLCAwKTsKK30KKzwvc2NyaXB0PgorCis8aWZyYW1lIHNyY2RvYz0iPHNjcmlw
dD52YXIgcHduZWQgPSAxOzwvc2NyaXB0PiI+PC9pZnJhbWU+Cis8aWZyYW1lIHNyY2RvYz0iPHN2
Zz48c2NyaXB0PnZhciBwd25lZCA9IDE7PC9zY3JpcHQ+PC9zdmc+Ij48L2lmcmFtZT4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>194705</attachid>
            <date>2013-03-23 09:09:20 -0700</date>
            <delta_ts>2013-03-27 15:45:20 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-113122-20130323090506.patch</filename>
            <type>text/plain</type>
            <size>7014</size>
            <attacher name="Geoffrey Garen">ggaren</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDE0NjY5MikKKysrIFNvdXJjZS9XZWJDb3JlL0NoYW5n
ZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDMyIEBACisyMDEzLTAzLTIyICBHZW9mZnJl
eSBHYXJlbiAgPGdnYXJlbkBhcHBsZS5jb20+CisKKyAgICAgICAgSG9ub3IgdGhlIHNldHRpbmcg
Zm9yIHdoZXRoZXIgSmF2YVNjcmlwdCBtYXJrdXAgaXMgZW5hYmxlZAorICAgICAgICBodHRwczov
L2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTEzMTIyCisKKyAgICAgICAgUmV2aWV3
ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgKiBkb20vU2NyaXB0YWJsZURvY3VtZW50
UGFyc2VyLmNwcDoKKyAgICAgICAgKFdlYkNvcmU6OlNjcmlwdGFibGVEb2N1bWVudFBhcnNlcjo6
U2NyaXB0YWJsZURvY3VtZW50UGFyc2VyKTogQXBwbGllZCB0aGUKKyAgICAgICAgc2V0dGluZyBo
ZXJlLCBzbyBhbGwgZG9jdW1lbnQgcGFyc2luZyB3b3VsZCBiZSBjb3ZlcmVkLiBUaGlzIGlzIHNp
bWlsYXIKKyAgICAgICAgdG8gd2hhdCB3ZSBkbyBmb3IgcGx1Zy1pbiBzdHJpcHBpbmcuCisKKyAg
ICAgICAgKiBodG1sL3BhcnNlci9IVE1MQ29uc3RydWN0aW9uU2l0ZS5jcHA6CisgICAgICAgIChX
ZWJDb3JlOjpIVE1MQ29uc3RydWN0a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0gZnVuY3Rpb24gdGVzdCgpCit7CisJdmFyIGRvY3Vt
ZW50V2l0aFNjcmlwdCA9IGZyYW1lc1swXS5kb2N1bWVudDsKKyAgICBzaG91bGRCZSgnZG9jdW1l
bnRXaXRoU2NyaXB0LmdldEVsZW1lbnRzQnlUYWdOYW1lKCJzY3JpcHQiKS5sZW5ndGgnLCBkb2N1
bWVudFdpdGhTY3JpcHQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoInNjcmlwdCIpLmxlbmd0aCwgMCk7
CisKKyAgICB2YXIgZG9jdW1lbnRXaXRoU1ZHU2NyaXB0ID0gZnJhbWVzWzFdLmRvY3VtZW50Owor
ICAgIHNob3VsZEJlKCdkb2N1bWVudFdpdGhTVkdTY3JpcHQuZ2V0RWxlbWVudHNCeVRhZ05hbWUo
InNjcmlwdCIpLmxlbmd0aCcsIGRvY3VtZW50V2l0aFNWR1NjcmlwdC5nZXRFbGVtZW50c0J5VGFn
TmFtZSgic2NyaXB0IikubGVuZ3RoLCAwKTsKK30KKzwvc2NyaXB0PgorCis8aWZyYW1lIHNyY2Rv
Yz0iPHNjcmlwdD52YXIgcHduZWQgPSAxOzwvc2NyaXB0PiI+PC9pZnJhbWU+Cis8aWZyYW1lIHNy
Y2RvYz0iPHN2Zz48c2NyaXB0PnZhciBwd25lZCA9IDE7PC9zY3JpcHQ+PC9zdmc+Ij48L2lmcmFt
ZT4K
</data>
<flag name="review"
          id="216480"
          type_id="1"
          status="+"
          setter="rniwa"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>194719</attachid>
            <date>2013-03-23 15:06:26 -0700</date>
            <delta_ts>2013-03-23 15:06:26 -0700</delta_ts>
            <desc>Attempt to create a reduction with copy &amp; paste</desc>
            <filename>113122.html</filename>
            <type>text/html</type>
            <size>699</size>
            <attacher name="Ryosuke Niwa">rniwa</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8Ym9keT4KPGRpdiBpZD0ic291cmNlIiBvbmNvcHk9InBh
c3RlU2NyaXB0KGV2ZW50KSIgY29udGVudGVkaXRhYmxlPmNvcHkgbWU8L2Rpdj4KPGRpdiBpZD0i
ZGVzdGluYXRpb24iIG9ucGFzdGU9InBhc3RlZCh0aGlzKSIgY29udGVudGVkaXRhYmxlPnBhc3Rl
IGl0IGhlcmU8L2Rpdj4KPHNjcmlwdD4KCmZ1bmN0aW9uIHBhc3RlU2NyaXB0KGV2ZW50KSB7CiAg
ICBldmVudC5wcmV2ZW50RGVmYXVsdCgpOwogICAgZXZlbnQuY2xpcGJvYXJkRGF0YS5zZXREYXRh
KCd0ZXh0L2h0bWwnLCAnPHN2ZyB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgd2lkdGg9IjEwcHgiIGhl
aWdodD0iMTBweCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9z
dmciPjxzY3JpcHQ+YWxlcnQoInB3bmQhIik8L3NjcicgKyAnaXB0Pjwvc3ZnPicpCn0KCmZ1bmN0
aW9uIHBhc3RlZChlbGVtZW50KSB7CiAgICBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHsKICAgICAg
ICBhbGVydChlbGVtZW50LmlubmVySFRNTCk7CiAgICB9LCAwKTsKfQoKc2V0VGltZW91dChmdW5j
dGlvbiAoKSB7CiAgICBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnc291cmNlJykuZm9jdXMoKTsK
ICAgIGRvY3VtZW50LmV4ZWNDb21tYW5kKCdzZWxlY3RBbGwnKTsKfSwgMCk7Cgo8L3NjcmlwdD4K
PC9ib2R5Pgo8L2h0bWw+
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>194769</attachid>
            <date>2013-03-24 15:08:30 -0700</date>
            <delta_ts>2013-03-24 15:08:30 -0700</delta_ts>
            <desc>Script injection attack examples</desc>
            <filename>scratch.html</filename>
            <type>text/html</type>
            <size>1002</size>
            <attacher name="Geoffrey Garen">ggaren</attacher>
            
              <data encoding="base64">PGlmcmFtZSBpZD0ic291cmNlMSIgc2FuZGJveD0iYWxsb3ctc2FtZS1vcmlnaW4iIHNyY2RvYz0i
PHNjcmlwdD5hbGVydCgnU2NyaXB0IGluamVjdGlvbiBhdHRhY2sgc3VjY2VlZGVkICg8c2NyaXB0
PikuJyk8L3NjcmlwdD48aW1nIHNyYz0nZGF0YTppbWFnZS9naWY7YmFzZTY0LFIwbEdPRGxoQVFB
QkFJQUFBT1RtN0FBQUFDSDVCQUVBQUFBQUxBQUFBQUFCQUFFQUFBSUNSQUVBT3c9PScgb25sb2Fk
PSdhbGVydCgmcXVvdDtTY3JpcHQgaW5qZWN0aW9uIGF0dGFjayBzdWNjZWVkZWQgKDxpbWc+KS4m
cXVvdDspJz48L2ltZz4iPjwvaWZyYW1lPgo8aWZyYW1lIGlkPSJkZXN0aW5hdGlvbjEiPjwvaWZy
YW1lPgo8aWZyYW1lIGlkPSJkZXN0aW5hdGlvbjIiPjwvaWZyYW1lPgo8aWZyYW1lIGlkPSJkZXN0
aW5hdGlvbjMiPjwvaWZyYW1lPgoKPHNjcmlwdD4KZnVuY3Rpb24gcmVwb3J0U2NyaXB0KCkKewoJ
YWxlcnQoJ1NjcmlwdCBpbmplY3Rpb24gYXR0YWNrIHN1Y2NlZWRlZCAoPHNjcmlwdD4pLicpOwp9
CgpmdW5jdGlvbiByZXBvcnRJbWFnZSgpCnsKCWFsZXJ0KCdTY3JpcHQgaW5qZWN0aW9uIGF0dGFj
ayBzdWNjZWVkZWQgKDxpbWc+KS4nKQp9CgpmdW5jdGlvbiAkKGlkKQp7CglyZXR1cm4gZG9jdW1l
bnQuZ2V0RWxlbWVudEJ5SWQoaWQpOwp9Cgp3aW5kb3cub25sb2FkID0gZnVuY3Rpb24oKSB7Cgkk
KCJkZXN0aW5hdGlvbjEiKS5jb250ZW50RG9jdW1lbnQud3JpdGUoCgkJJCgic291cmNlMSIpLmNv
bnRlbnREb2N1bWVudC5maXJzdENoaWxkLmlubmVySFRNTCk7CgoJJCgiZGVzdGluYXRpb24yIiku
c2V0QXR0cmlidXRlKCJzcmNEb2MiLAoJCSQoInNvdXJjZTEiKS5jb250ZW50RG9jdW1lbnQuZmly
c3RDaGlsZC5pbm5lckhUTUwpOwoKCSQoImRlc3RpbmF0aW9uMyIpLnNldEF0dHJpYnV0ZSgic3Jj
IiwKCQkiZGF0YTp0ZXh0L2h0bWwsICIgKyAkKCJzb3VyY2UxIikuY29udGVudERvY3VtZW50LmZp
cnN0Q2hpbGQuaW5uZXJIVE1MKTsKfQo8L3NjcmlwdD4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>194891</attachid>
            <date>2013-03-25 11:11:01 -0700</date>
            <delta_ts>2013-03-25 11:11:01 -0700</delta_ts>
            <desc>Specific demonstration of why an empty script element is dangerous</desc>
            <filename>scratch.html</filename>
            <type>text/html</type>
            <size>780</size>
            <attacher name="Geoffrey Garen">ggaren</attacher>
            
              <data encoding="base64">PGlmcmFtZSBpZD0ic291cmNlIiBzYW5kYm94PSJhbGxvdy1zYW1lLW9yaWdpbiIgc3JjZG9jPSI8
Ym9keT48c2NyaXB0Pjwvc2NyaXB0PjxwPlVyZ2VudDogUmVwbHkgdG8gdGhpcyBlbWFpbC48L3A+
PHA+LS0gWW91ciBCYW5rIChUTSk8L3A+PC9ib2R5PiI+PC9pZnJhbWU+CjxpZnJhbWUgaWQ9ImRl
c3RpbmF0aW9uIj48L2lmcmFtZT4KCjxzY3JpcHQ+CmZ1bmN0aW9uICQoaWQpCnsKCXJldHVybiBk
b2N1bWVudC5nZXRFbGVtZW50QnlJZChpZCk7Cn0KCmZ1bmN0aW9uIGFyYml0cmFyeVNvdXJjZSgp
CnsKCXJldHVybiAiYWxlcnQoJ1NjcmlwdCBpbmplY3Rpb24gYXR0YWNrIHN1Y2NlZWRlZCAoPHNj
cmlwdD4pLicpI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