<?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>198966</bug_id>
          
          <creation_ts>2019-06-18 09:03:06 -0700</creation_ts>
          <short_desc>StorageManager::removeAllowedSessionStorageNamespaceConnection should make sure its storageNamespaceID is valid</short_desc>
          <delta_ts>2019-07-01 16:58:25 -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>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=199208</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=199388</see_also>
          <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="youenn fablet">youennf</reporter>
          <assigned_to name="youenn fablet">youennf</assigned_to>
          <cc>achristensen</cc>
    
    <cc>beidson</cc>
    
    <cc>commit-queue</cc>
    
    <cc>sihui_liu</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1545627</commentid>
    <comment_count>0</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2019-06-18 09:03:06 -0700</bug_when>
    <thetext>StorageManager::removeAllowedSessionStorageNamespaceConnection should make sure its storageNamespaceID is valid</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1545630</commentid>
    <comment_count>1</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2019-06-18 09:07:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/51352080&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1545632</commentid>
    <comment_count>2</comment_count>
      <attachid>372341</attachid>
    <who name="youenn fablet">youennf</who>
    <bug_when>2019-06-18 09:14:10 -0700</bug_when>
    <thetext>Created attachment 372341
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1545648</commentid>
    <comment_count>3</comment_count>
      <attachid>372341</attachid>
    <who name="Sihui Liu">sihui_liu</who>
    <bug_when>2019-06-18 10:10:39 -0700</bug_when>
    <thetext>Comment on attachment 372341
Patch

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

&gt; Source/WebKit/ChangeLog:10
&gt; +        The namespace ID is coming straight from IPC so should not be trusted.

I agree with this, but I don&apos;t think this crash is caused by untrusted message sent to web process. Likely there is a bug in the code (e.g. web page was removed before it&apos;s getting added because of some race), and using the If condition here will conceal the real bug.

But as we also don&apos;t like the idea of notifying network process when page is added/removed in web process for sessionStorage, this may be a good enough fix before we drop those code.

&gt; Source/WebKit/ChangeLog:13
&gt; +        Also, namespace IDs are added/removed based on web pages being created/deleted.
&gt; +        Namespace IDs are supposed to be scoped by session IDs.
&gt; +        Using page IDs for namespace IDs works as long as the page does not change of session ID during its lifetime, which is not guaranteed.

If my understanding is correct, if page is changing its session, it should add itself to new storage session(StorageManager) first, which will create a new sessionStorageNameSpace that have the corresponding namespace/page ID.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1545664</commentid>
    <comment_count>4</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2019-06-18 10:38:25 -0700</bug_when>
    <thetext>&gt; I agree with this, but I don&apos;t think this crash is caused by untrusted
&gt; message sent to web process. Likely there is a bug in the code (e.g. web
&gt; page was removed before it&apos;s getting added because of some race), and using
&gt; the If condition here will conceal the real bug.
&gt; 
&gt; But as we also don&apos;t like the idea of notifying network process when page is
&gt; added/removed in web process for sessionStorage, this may be a good enough
&gt; fix before we drop those code.

Yes, the patch is only about fixing the crash.
It should be completed by either retiring the use of page IDs, or making it fully working.
I think the end goal should be to retire the use of page IDs here.

&gt; &gt; Source/WebKit/ChangeLog:13
&gt; &gt; +        Also, namespace IDs are added/removed based on web pages being created/deleted.
&gt; &gt; +        Namespace IDs are supposed to be scoped by session IDs.
&gt; &gt; +        Using page IDs for namespace IDs works as long as the page does not change of session ID during its lifetime, which is not guaranteed.
&gt; 
&gt; If my understanding is correct, if page is changing its session, it should
&gt; add itself to new storage session(StorageManager) first, which will create a
&gt; new sessionStorageNameSpace that have the corresponding namespace/page ID.

I am not sure what we want in the short term.
Maybe it is ok to fix this one before trying to remove the page ID usage.
I fear that we may see other bugs in that area until we remove page ID usage.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1545666</commentid>
    <comment_count>5</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2019-06-18 10:39:35 -0700</bug_when>
    <thetext>&gt; I agree with this, but I don&apos;t think this crash is caused by untrusted
&gt; message sent to web process. Likely there is a bug in the code (e.g. web
&gt; page was removed before it&apos;s getting added because of some race), and using
&gt; the If condition here will conceal the real bug.

There is a debug assertion to catch the real bug.
The crash might come from session ID change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1545678</commentid>
    <comment_count>6</comment_count>
      <attachid>372341</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-06-18 11:10:14 -0700</bug_when>
    <thetext>Comment on attachment 372341
Patch

Clearing flags on attachment: 372341

Committed r246552: &lt;https://trac.webkit.org/changeset/246552&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1545679</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2019-06-18 11:10:16 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1547870</commentid>
    <comment_count>8</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2019-06-25 16:27:31 -0700</bug_when>
    <thetext>*** Bug 199208 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>372341</attachid>
            <date>2019-06-18 09:14:10 -0700</date>
            <delta_ts>2019-06-18 11:10:14 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-198966-20190618091410.patch</filename>
            <type>text/plain</type>
            <size>2300</size>
            <attacher name="youenn fablet">youennf</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjQ2NDUxCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCmluZGV4IGYyYWFhYjQzYmQ4YzhlOGNm
MDlhOGI4M2Y5ODU4YTdiMTQwNmZkMzEuLjFhMGIwNWJjZTIyYTI2YWQ2ZGRkODQxZjFkZTVhNTdk
Y2IzMDQyOGIgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9nCisrKyBiL1NvdXJj
ZS9XZWJLaXQvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMjAgQEAKKzIwMTktMDYtMTggIFlvdWVubiBG
YWJsZXQgIDx5b3Vlbm5AYXBwbGUuY29tPgorCisgICAgICAgIFN0b3JhZ2VNYW5hZ2VyOjpyZW1v
dmVBbGxvd2VkU2Vzc2lvblN0b3JhZ2VOYW1lc3BhY2VDb25uZWN0aW9uIHNob3VsZCBtYWtlIHN1
cmUgaXRzIHN0b3JhZ2VOYW1lc3BhY2VJRCBpcyB2YWxpZAorICAgICAgICBodHRwczovL2J1Z3Mu
d2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTk4OTY2CisgICAgICAgIHJkYXI6Ly9wcm9ibGVt
LzUxMzUyMD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