<?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>214745</bug_id>
          
          <creation_ts>2020-07-24 09:34:29 -0700</creation_ts>
          <short_desc>CrashTracer: com.apple.WebKit.WebContent at com.apple.WebKit: WebKit::WebFrame::shouldEnableInAppBrowserPrivacyProtections</short_desc>
          <delta_ts>2020-07-28 09:20: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>WebKit Misc.</component>
          <version>WebKit 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>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kate Cheney">katherine_cheney</reporter>
          <assigned_to name="Kate Cheney">katherine_cheney</assigned_to>
          <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>ddkilzer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1674698</commentid>
    <comment_count>0</comment_count>
    <who name="Kate Cheney">katherine_cheney</who>
    <bug_when>2020-07-24 09:34:29 -0700</bug_when>
    <thetext>WebKit: WebKit::WebFrame::shouldEnableInAppBrowserPrivacyProtections() is crashing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674699</commentid>
    <comment_count>1</comment_count>
    <who name="Kate Cheney">katherine_cheney</who>
    <bug_when>2020-07-24 09:34:45 -0700</bug_when>
    <thetext>&lt;rdar://66018965&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674709</commentid>
    <comment_count>2</comment_count>
      <attachid>405160</attachid>
    <who name="Kate Cheney">katherine_cheney</who>
    <bug_when>2020-07-24 09:44:37 -0700</bug_when>
    <thetext>Created attachment 405160
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674713</commentid>
    <comment_count>3</comment_count>
      <attachid>405160</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-07-24 09:54:43 -0700</bug_when>
    <thetext>Comment on attachment 405160
Patch

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

&gt; Source/WebKit/WebProcess/WebPage/WebFrame.cpp:-865
&gt; -        for (WebFrame* frame = this; !frame-&gt;isMainFrame(); frame = frame-&gt;parentFrame()) {

To maintain previous behavior, we should have used:
frame &amp;&amp; !frame-&gt;isMainFrame()

&gt; Source/WebKit/WebProcess/WebPage/WebFrame.cpp:865
&gt; +        for (WebFrame* frame = this; frame; frame = frame-&gt;parentFrame()) {

This is a behavior change because we are now going to run the code in the loop for the main frame. Is that OK?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674751</commentid>
    <comment_count>4</comment_count>
    <who name="Kate Cheney">katherine_cheney</who>
    <bug_when>2020-07-24 10:56:48 -0700</bug_when>
    <thetext>(In reply to Chris Dumez from comment #3)
&gt; Comment on attachment 405160 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=405160&amp;action=review
&gt; 
&gt; &gt; Source/WebKit/WebProcess/WebPage/WebFrame.cpp:-865
&gt; &gt; -        for (WebFrame* frame = this; !frame-&gt;isMainFrame(); frame = frame-&gt;parentFrame()) {
&gt; 
&gt; To maintain previous behavior, we should have used:
&gt; frame &amp;&amp; !frame-&gt;isMainFrame()
&gt; 
&gt; &gt; Source/WebKit/WebProcess/WebPage/WebFrame.cpp:865
&gt; &gt; +        for (WebFrame* frame = this; frame; frame = frame-&gt;parentFrame()) {
&gt; 
&gt; This is a behavior change because we are now going to run the code in the
&gt; loop for the main frame. Is that OK?

Yes, this is ok. Right now we have a separate check in place in WebPageProxy.cpp where if the main frame is not app-bound, we will enable app-bound domain protections for all further loads, so we don&apos;t rely on this loop being run for the main frame. But it doesn&apos;t hurt to check it here as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674756</commentid>
    <comment_count>5</comment_count>
      <attachid>405160</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2020-07-24 11:04:50 -0700</bug_when>
    <thetext>Comment on attachment 405160
Patch

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

&gt; Source/WebKit/ChangeLog:10
&gt; +        We should stop iterating if the frame is null, even if it is not
&gt; +        the main frame, to avoid calling functions on a null frame.

This means that we are running JS in a detached frame, which seems like a bigger problem that a mere crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674798</commentid>
    <comment_count>6</comment_count>
    <who name="Kate Cheney">katherine_cheney</who>
    <bug_when>2020-07-24 13:06:48 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #5)
&gt; Comment on attachment 405160 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=405160&amp;action=review
&gt; 
&gt; &gt; Source/WebKit/ChangeLog:10
&gt; &gt; +        We should stop iterating if the frame is null, even if it is not
&gt; &gt; +        the main frame, to avoid calling functions on a null frame.
&gt; 
&gt; This means that we are running JS in a detached frame, which seems like a
&gt; bigger problem that a mere crash.

Agreed, perhaps this should be a separate investigation though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674810</commentid>
    <comment_count>7</comment_count>
      <attachid>405160</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2020-07-24 14:00:06 -0700</bug_when>
    <thetext>Comment on attachment 405160
Patch

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

&gt;&gt;&gt; Source/WebKit/ChangeLog:10
&gt;&gt;&gt; +        the main frame, to avoid calling functions on a null frame.
&gt;&gt; 
&gt;&gt; This means that we are running JS in a detached frame, which seems like a bigger problem that a mere crash.
&gt; 
&gt; Agreed, perhaps this should be a separate investigation though.

I&apos;m not sure if adding the null check will improve customer experience. Running JS in a detached frame will likely crash anyway, just in a different place, but it wold be just as bad for the user. It can also expose a security vulnerability that used to be prevented by the null pointer crash, but turns into a logic error without the crash.

Sometimes we don&apos;t know what&apos;s happening and spray null pointer checks without much thinking, but this specific case seems to be more suspicious than most.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674815</commentid>
    <comment_count>8</comment_count>
      <attachid>405160</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2020-07-24 14:13:22 -0700</bug_when>
    <thetext>Comment on attachment 405160
Patch

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

&gt;&gt;&gt;&gt; Source/WebKit/ChangeLog:10
&gt;&gt;&gt;&gt; +        the main frame, to avoid calling functions on a null frame.
&gt;&gt;&gt; 
&gt;&gt;&gt; This means that we are running JS in a detached frame, which seems like a bigger problem that a mere crash.
&gt;&gt; 
&gt;&gt; Agreed, perhaps this should be a separate investigation though.
&gt; 
&gt; I&apos;m not sure if adding the null check will improve customer experience. Running JS in a detached frame will likely crash anyway, just in a different place, but it wold be just as bad for the user. It can also expose a security vulnerability that used to be prevented by the null pointer crash, but turns into a logic error without the crash.
&gt; 
&gt; Sometimes we don&apos;t know what&apos;s happening and spray null pointer checks without much thinking, but this specific case seems to be more suspicious than most.

This is a top crasher and a very recent regression from Kate adding this shouldEnableInAppBrowserPrivacyProtections() check. I think a fix in this shouldEnableInAppBrowserPrivacyProtections() is very reasonable for such crash.
Whether or not this function was called on detached frames did NOT change when Kate added the shouldEnableInAppBrowserPrivacyProtections() check.

Also note that if we were crashing before Kate&apos;s patch then we would have seen a top crasher in this code path. I am not aware that we have. We don&apos;t have evidence that this method crashes or does something bad when called on a detached frame. We do have evidence that Kate&apos;s recent addition of the shouldEnableInAppBrowserPrivacyProtections() introduced a crash and she is fixing that crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674816</commentid>
    <comment_count>9</comment_count>
    <who name="Kate Cheney">katherine_cheney</who>
    <bug_when>2020-07-24 14:17:16 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #7)
&gt; Comment on attachment 405160 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=405160&amp;action=review
&gt; 
&gt; &gt;&gt;&gt; Source/WebKit/ChangeLog:10
&gt; &gt;&gt;&gt; +        the main frame, to avoid calling functions on a null frame.
&gt; &gt;&gt; 
&gt; &gt;&gt; This means that we are running JS in a detached frame, which seems like a bigger problem that a mere crash.
&gt; &gt; 
&gt; &gt; Agreed, perhaps this should be a separate investigation though.
&gt; 
&gt; I&apos;m not sure if adding the null check will improve customer experience.
&gt; Running JS in a detached frame will likely crash anyway, just in a different
&gt; place, but it wold be just as bad for the user. It can also expose a
&gt; security vulnerability that used to be prevented by the null pointer crash,
&gt; but turns into a logic error without the crash.
&gt; 
&gt; Sometimes we don&apos;t know what&apos;s happening and spray null pointer checks
&gt; without much thinking, but this specific case seems to be more suspicious
&gt; than most.

My thought is that fixing this will return customer experience to whatever it was prior to this code being added, which is probably like you said another crash or protection put in place to prevent JS execution in a detached frame. If it&apos;s another crash, we will see it in CrashTracer. If it&apos;s a handled error, we probably don&apos;t need to do anything. And if it is not addressed, we can fix it in a separate patch. Do you have another idea for addressing this bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674818</commentid>
    <comment_count>10</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2020-07-24 14:18:21 -0700</bug_when>
    <thetext>&gt; a very recent regression from Kate adding this shouldEnableInAppBrowserPrivacyProtections() check

OK then.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674824</commentid>
    <comment_count>11</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2020-07-24 14:32:24 -0700</bug_when>
    <thetext>Committed r264859: &lt;https://trac.webkit.org/changeset/264859&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 405160.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1674941</commentid>
    <comment_count>12</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2020-07-24 18:15:23 -0700</bug_when>
    <thetext>What is the next step for addressing the root cause?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1675636</commentid>
    <comment_count>13</comment_count>
    <who name="Kate Cheney">katherine_cheney</who>
    <bug_when>2020-07-28 09:20:31 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #12)
&gt; What is the next step for addressing the root cause?

&lt;rdar://problem/66221089&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>405160</attachid>
            <date>2020-07-24 09:44:37 -0700</date>
            <delta_ts>2020-07-24 14:32:24 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-214745-20200724094435.patch</filename>
            <type>text/plain</type>
            <size>1908</size>
            <attacher name="Kate Cheney">katherine_cheney</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjY0NjYzCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCmluZGV4IDY4ODU2NWRhY2E5NWU0YWIy
ZThmMzAyMmU3NTA2YjcwMDc0MjNkMDMuLmQ0MDcyNTg5MDJlMDhhOTVhN2JhNTA0ODAwNDdkMDU2
MmEzMDQ4NTggMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCisrKyBiL1NvdXJj
ZS9XZWJLaXQvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTcgQ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