<?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>111264</bug_id>
          
          <creation_ts>2013-03-03 01:04:58 -0800</creation_ts>
          <short_desc>XSSAuditor::eraseDangerousAttributesIfInjected shouldn&apos;t malloc for each attribute.</short_desc>
          <delta_ts>2021-09-21 14:27:50 -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>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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>111249</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mike West">mkwst</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>bfulgham</cc>
    
    <cc>dbates</cc>
    
    <cc>dglazkov</cc>
    
    <cc>dsavints</cc>
    
    <cc>eric</cc>
    
    <cc>esprehn+autocc</cc>
    
    <cc>ojan.autocc</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>845968</commentid>
    <comment_count>0</comment_count>
    <who name="Mike West">mkwst</who>
    <bug_when>2013-03-03 01:04:58 -0800</bug_when>
    <thetext>As noted in bug 111071 and https://bugs.webkit.org/show_bug.cgi?id=111249#c4, we&apos;re doing more work than we should in XSSAuditor::eraseDangerousAttributesIfInjected. We end up mallocing for every attribute in the document, which isn&apos;t awesome.

I took a quick pass at dropping the String() call by simplifying the logic of the check, which gets 90% of the way there. Unfortunately, &apos;protocolIsJavaScript()&apos; ends up doing some important work down in platform-specific code (url_util::FindAndCompareScheme) to strip out control characters that are ignored in the context of an HTML document. It&apos;s a bit ugly.

I&apos;ll upload the patch I was playing with, if only as an example of how not to go about dropping this constructor. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845969</commentid>
    <comment_count>1</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2013-03-03 01:06:44 -0800</bug_when>
    <thetext>Thanks for investigating this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845970</commentid>
    <comment_count>2</comment_count>
      <attachid>191130</attachid>
    <who name="Mike West">mkwst</who>
    <bug_when>2013-03-03 01:06:50 -0800</bug_when>
    <thetext>Created attachment 191130
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>845971</commentid>
    <comment_count>3</comment_count>
    <who name="Mike West">mkwst</who>
    <bug_when>2013-03-03 01:11:00 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Created an attachment (id=191130) [details]
&gt; Patch

Er, sorry about the watchlist spam. I meant to upload this without r?.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>846010</commentid>
    <comment_count>4</comment_count>
      <attachid>191130</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2013-03-03 06:54:34 -0800</bug_when>
    <thetext>Comment on attachment 191130
Patch

Attachment 191130 did not pass chromium-ews (chromium-xvfb):
Output: http://webkit-commit-queue.appspot.com/results/16899396

New failing tests:
http/tests/security/xssAuditor/iframe-injection.html
http/tests/security/xssAuditor/full-block-base-href.html
http/tests/security/xssAuditor/formaction-on-input.html
http/tests/security/xssAuditor/embed-tag-null-char.html
http/tests/security/xssAuditor/embed-tag-javascript-url.html
http/tests/security/xssAuditor/cookie-injection.html
http/tests/security/xssAuditor/anchor-url-dom-write-location-inline-event.html
http/tests/security/xssAuditor/embed-tag-control-char.html
http/tests/cache/subresource-failover-to-network.html
http/tests/security/xssAuditor/full-block-javascript-link.html
http/tests/security/xssAuditor/form-action.html
http/tests/security/xssAuditor/anchor-url-dom-write-location-inline-event-null-char.html
http/tests/security/xssAuditor/base-href-scheme-relative.html
http/tests/security/xssAuditor/anchor-url-dom-write-location-javascript-URL.html
http/tests/security/xssAuditor/iframe-injection-allowed.html
http/tests/security/xssAuditor/cached-frame.html
http/tests/security/xssAuditor/dom-write-location-javascript-URL.html
http/tests/security/xssAuditor/iframe-injection-allowed-2.html
http/tests/security/xssAuditor/formaction-on-button.html
http/tests/security/xssAuditor/embed-tag.html
http/tests/security/xssAuditor/embed-tag-code-attribute-2.html
http/tests/security/xssAuditor/base-href.html
http/tests/security/xssAuditor/full-block-iframe-javascript-url.html
http/tests/security/xssAuditor/base-href-null-char.html
http/tests/security/xssAuditor/dom-write-location-inline-event.html
http/tests/security/xssAuditor/full-block-script-tag-with-source.html
http/tests/security/xssAuditor/iframe-injection-allowed-3.html
http/tests/security/xssAuditor/embed-tag-code-attribute.html
http/tests/security/xssAuditor/base-href-control-char.html
http/tests/security/xssAuditor/full-block-object-tag.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1795770</commentid>
    <comment_count>5</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2021-09-21 14:27:50 -0700</bug_when>
    <thetext>This code is removed in Bug 230499.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>191130</attachid>
            <date>2013-03-03 01:06:50 -0800</date>
            <delta_ts>2013-03-03 06:54:34 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-111264-20130303100258.patch</filename>
            <type>text/plain</type>
            <size>3136</size>
            <attacher name="Mike West">mkwst</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTQ0NTQwCmRpZmYgLS1naXQgYS9Tb3V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x0ZXJUb2tlblJlcXVlc3QmIHJlCiAg
ICAgZm9yIChzaXplX3QgaSA9IDA7IGkgPCByZXF1ZXN0LnRva2VuLmF0dHJpYnV0ZXMoKS5zaXpl
KCk7ICsraSkgewogICAgICAgICBjb25zdCBIVE1MVG9rZW46OkF0dHJpYnV0ZSYgYXR0cmlidXRl
ID0gcmVxdWVzdC50b2tlbi5hdHRyaWJ1dGVzKCkuYXQoaSk7CiAgICAgICAgIGJvb2wgaXNJbmxp
bmVFdmVudEhhbmRsZXIgPSBpc05hbWVPZklubGluZUV2ZW50SGFuZGxlcihhdHRyaWJ1dGUubmFt
ZSk7Ci0gICAgICAgIGJvb2wgdmFsdWVDb250YWluc0phdmFTY3JpcHRVUkwgPSAhaXNJbmxpbmVF
dmVudEhhbmRsZXIgJiYgcHJvdG9jb2xJc0phdmFTY3JpcHQoc3RyaXBMZWFkaW5nQW5kVHJhaWxp
bmdIVE1MU3BhY2VzKFN0cmluZyhhdHRyaWJ1dGUudmFsdWUpKSk7CisgICAgICAgIGJvb2wgdmFs
dWVDb250YWluc0phdmFTY3JpcHRVUkwgPSAhaXNJbmxpbmVFdmVudEhhbmRsZXIgJiYgaGFzSmF2
YVNjcmlwdFByb3RvY29sKGF0dHJpYnV0ZS52YWx1ZSk7CiAgICAgICAgIGlmICghaXNJbmxpbmVF
dmVudEhhbmRsZXIgJiYgIXZhbHVlQ29udGFpbnNKYXZhU2NyaXB0VVJMKQogICAgICAgICAgICAg
Y29udGludWU7CiAgICAgICAgIGlmICghaXNDb250YWluZWRJblJlcXVlc3QoZGVjb2RlZFNuaXBw
ZXRGb3JBdHRyaWJ1dGUocmVxdWVzdCwgYXR0cmlidXRlLCBTY3JpcHRMaWtlQXR0cmlidXRlKSkp
Cg==
</data>
<flag name="commit-queue"
          id="212012"
          type_id="3"
          status="-"
          setter="webkit.review.bot"
    />
          </attachment>
      

    </bug>

</bugzilla>