<?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>156086</bug_id>
          
          <creation_ts>2016-03-31 15:16:39 -0700</creation_ts>
          <short_desc>CSP: Define explicitly datatype for nonce</short_desc>
          <delta_ts>2016-05-27 12:35:31 -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>WebKit Local Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Daniel Bates">dbates</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1179614</commentid>
    <comment_count>0</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2016-03-31 15:16:39 -0700</bug_when>
    <thetext>Currently in the Content Security Policy code we represent nonces as String objects and have overloaded functions that take either a URL or a nonce. Notice that a URL object can be implicitly converted to a String object because the URL class defines a String conversion operator. This makes passing a nonce to an overloaded functions with default arguments that accepts either a URL or String in the same argument position error prone because the compiler may chose to implicitly convert a URL to a String and call the overloaded function for a nonce. One example of fragile function because of the implicit conversion of URL to String is the static non-member function checkFrameAncestors() (defined in file ContentSecurityPolicyDirectiveList.cpp): &lt;http://trac.webkit.org/browser/trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp?rev=198920#L79&gt;. Care must be taken to update this call site should ContentSecurityPolicySourceListDirective ::allow(const URL&amp;), &lt;http://trac.webkit.org/browser/trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceListDirective.h?rev=198920#L41&gt;, be changed to take a default argument as its second argument. Otherwise, the compiler will implicitly convert the result of &quot;current-&gt;document()-&gt;url()&quot; in checkFrameAncestors() from a URL object to a String object and generate code to invoke ContentSecurityPolicySourceListDirective ::allow(const String&amp;), which is the overloaded function for checking a nonce.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>