Bug 228708 - [App Privacy Report] Domains are deleted for ephemeral website data stores
Summary: [App Privacy Report] Domains are deleted for ephemeral website data stores
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kate Cheney
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-08-02 11:25 PDT by Kate Cheney
Modified: 2021-08-02 17:55 PDT (History)
5 users (show)

See Also:


Attachments
Patch (18.46 KB, patch)
2021-08-02 11:42 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch (2.42 KB, patch)
2021-08-02 15:58 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch for landing (9.63 KB, patch)
2021-08-02 16:56 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff
Patch for landing (2.52 KB, patch)
2021-08-02 17:00 PDT, Kate Cheney
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kate Cheney 2021-08-02 11:25:37 PDT
[App Privacy Report] Domains are deleted for ephemeral website data stores
Comment 1 Kate Cheney 2021-08-02 11:42:50 PDT
Created attachment 434781 [details]
Patch
Comment 2 Kate Cheney 2021-08-02 14:12:11 PDT
Comment on attachment 434781 [details]
Patch

Removing r flag, this should probably also fix the Safari Privacy Report case, which is basically an identical fix.
Comment 3 Alex Christensen 2021-08-02 15:08:37 PDT
Comment on attachment 434781 [details]
Patch

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

> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1830
> +    if (!dataStoreIsPersistent)

m_sessionID.isEphemeral()
Then you don't need to pass the redundant bool around.
Comment 4 Kate Cheney 2021-08-02 15:09:38 PDT
(In reply to Alex Christensen from comment #3)
> Comment on attachment 434781 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=434781&action=review
> 
> > Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1830
> > +    if (!dataStoreIsPersistent)
> 
> m_sessionID.isEphemeral()
> Then you don't need to pass the redundant bool around.

Will an ephemeral website data store automatically use an ephemeral session?
Comment 5 Alex Christensen 2021-08-02 15:11:01 PDT
Comment on attachment 434781 [details]
Patch

Yes.  WebsiteDataStore::isPersistent() and NetworkSessionCocoa::m_sessionID.isEphemeral() are opposites, getting their information from the same place.
Comment 6 Kate Cheney 2021-08-02 15:58:20 PDT
Created attachment 434797 [details]
Patch
Comment 7 Kate Cheney 2021-08-02 15:58:30 PDT
(In reply to Alex Christensen from comment #5)
> Comment on attachment 434781 [details]
> Patch
> 
> Yes.  WebsiteDataStore::isPersistent() and
> NetworkSessionCocoa::m_sessionID.isEphemeral() are opposites, getting their
> information from the same place.

TIL.
Comment 8 Alex Christensen 2021-08-02 16:50:46 PDT
Comment on attachment 434797 [details]
Patch

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

r=me

> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:1830
> +    if (sessionID().isEphemeral()) {

Could you add a radar link where you requested SPI to add an automated test for this?
// FIXME: Add automated test for this once rdar://???????? is resolved.
Comment 9 Kate Cheney 2021-08-02 16:56:42 PDT
Created attachment 434802 [details]
Patch for landing
Comment 10 EWS 2021-08-02 16:57:17 PDT
Tools/Scripts/svn-apply failed to apply attachment 434802 [details] to trunk.
Please resolve the conflicts and upload a new patch.
Comment 11 Kate Cheney 2021-08-02 17:00:22 PDT
Created attachment 434803 [details]
Patch for landing
Comment 12 Maciej Stachowiak 2021-08-02 17:04:03 PDT
Comment on attachment 434781 [details]
Patch

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

> Source/WebKit/ChangeLog:11
> +        No new tests. Since this data is not stored in WebKit, we have no
> +        way to test when it gets deleted or not. I tested manually and requested
> +        an automated test at the correct networking layer.

Should we consider making a testing hook for this so that a layout test or API test is possible?

> Source/WebKit/ChangeLog:17
> +        Only clear App Privacy Report data if the website data store is
> +        persistent. Safari calls the SPI to remove website data for ephemeral
> +        data stores in some cases that are unrelated to a user clearing
> +        website data or history and thus should not clear App Privacy Report
> +        data.

Private browsing is also an ephemeral data store. With this change, would private browsing leave traces in the Privacy Report data store, or do we have some other way of avoiding that?
Comment 13 Maciej Stachowiak 2021-08-02 17:08:41 PDT
<rdar://81282432>
Comment 14 Radar WebKit Bug Importer 2021-08-02 17:08:52 PDT
<rdar://problem/81436158>
Comment 15 Kate Cheney 2021-08-02 17:09:00 PDT
(In reply to Maciej Stachowiak from comment #12)
> Comment on attachment 434781 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=434781&action=review
> 
> > Source/WebKit/ChangeLog:11
> > +        No new tests. Since this data is not stored in WebKit, we have no
> > +        way to test when it gets deleted or not. I tested manually and requested
> > +        an automated test at the correct networking layer.
> 
> Should we consider making a testing hook for this so that a layout test or
> API test is possible?

Yes, I requested this in the radar mentioned in the FIXME. The ideal would be SPI that let us test this directly.

> 
> > Source/WebKit/ChangeLog:17
> > +        Only clear App Privacy Report data if the website data store is
> > +        persistent. Safari calls the SPI to remove website data for ephemeral
> > +        data stores in some cases that are unrelated to a user clearing
> > +        website data or history and thus should not clear App Privacy Report
> > +        data.
> 
> Private browsing is also an ephemeral data store. With this change, would
> private browsing leave traces in the Privacy Report data store, or do we
> have some other way of avoiding that?

Ephemeral sessions in full browsers (aka private browsing) do not log any information in the App Privacy Report. However, ephemeral sessions for non-browsers still log domains to prevent sidesteps of APR by using ephemeral sessions.
Comment 16 Radar WebKit Bug Importer 2021-08-02 17:09:10 PDT
<rdar://problem/81436167>
Comment 17 EWS 2021-08-02 17:55:21 PDT
Committed r280575 (240197@main): <https://commits.webkit.org/240197@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 434803 [details].