Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for first party storage removal on website close. #16470

Merged
merged 3 commits into from
Mar 21, 2023

Conversation

goodov
Copy link
Member

@goodov goodov commented Dec 23, 2022

Forget by default option is implemented as "Block cross-site cookies" + logic to delete cookies on website close.

The availability of the new mode is controlled by Enable First Party Storage Cleanup support on brave://flags or --enable-feature=BraveForgetFirstPartyStorage.

This PR doesn't change the "default" state for the shields cookie policy if the feature is enabled (it's still "Block cross-site cookies").

Spec: https://docs.google.com/document/d/1TeDqwnKqOJqSv0b80liZjAFR1BUPc6urGkkHiHN526s/

4cpjfSluSp.mp4

Core part for brave/brave-browser#26465

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@goodov goodov requested a review from a team as a code owner December 23, 2022 10:44
@github-actions github-actions bot added CI/run-network-audit Run network-audit CI/storybook-url Deploy storybook and provide a unique URL for each build labels Dec 23, 2022
@goodov goodov marked this pull request as draft December 23, 2022 10:49
@goodov goodov force-pushed the forget-by-default branch 2 times, most recently from 328f8db to f89d283 Compare December 23, 2022 14:28
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@goodov goodov marked this pull request as ready for review January 11, 2023 13:26
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@pes10k
Copy link
Contributor

pes10k commented Jan 11, 2023

This looks great @goodov, but i don't think it fully resolves brave/brave-browser#26465. We still need the second point in #26465 before we close #26465 out.

  1. Brave should give users a convenient way to “opt-into” a site remembering them (instead of making it the default)

Never the less, this is great stuff!

@goodov
Copy link
Member Author

goodov commented Jan 11, 2023

This looks great @goodov, but i don't think it fully resolves brave/brave-browser#26465. We still need the second point in #26465 before we close #26465 out.

  1. Brave should give users a convenient way to “opt-into” a site remembering them (instead of making it the default)

yes, definitely! I've removed "Resolves" keyword from the description.

Can you take a look at the UI strings and maybe suggest some changes (if any)?

@pes10k
Copy link
Contributor

pes10k commented Jan 11, 2023

@bradleyrichter wanted to ping you and your team on the wording here. We started discussing this a while back, but i dont think the design team landed on final text you all preferred. What do you all think is the ideal label here for what's called "Forget by default" in the video?

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@goodov goodov force-pushed the forget-by-default branch 2 times, most recently from 60d9782 to da3e16f Compare February 1, 2023 13:05
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@goodov goodov requested a review from a team as a code owner February 1, 2023 16:46
if (new_domain == previous_domain)
return;
net::URLToEphemeralStorageDomain(last_committed_url);
if (new_domain != previous_domain) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple of lines of comments wouldn't hurt

using FirstPartyStorageLifetimeKey =
std::pair<content::BrowserContext*, url::Origin>;

class FirstPartyStorageLifetime
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

class level comment?


namespace ephemeral_storage {

const char kFirstPartyStorageURLsToCleanup[] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment

private:
void OnCanEnable1PESForUrl(const GURL& url,
base::OnceCallback<void(bool)> on_ready,
bool can_enable_1pes);
bool IsDefaultCookieSetting(const GURL& url) const;

void CleanupFirstPartyStorageAreasOnStartup();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments, i.e. why / what for this is needed and used

@goodov
Copy link
Member Author

goodov commented Mar 20, 2023

@brave/android-tests-reviewers PTAL

Copy link
Contributor

@wchen342 wchen342 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/run-network-audit Run network-audit CI/storybook-url Deploy storybook and provide a unique URL for each build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants