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

3rd party cookie registry domains #5390

Merged
merged 5 commits into from
Apr 28, 2020
Merged

Conversation

bridiver
Copy link
Collaborator

@bridiver bridiver commented Apr 27, 2020

Resolves brave/brave-browser#9489

Submitter Checklist:

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

@bridiver bridiver requested review from pes10k and jumde April 27, 2020 19:01
@@ -33,7 +34,10 @@ Rule CloneRule(const Rule& rule, bool reverse_patterns = false) {
ContentSettingsPattern::FromString("https://firstParty/*")) {
if (!rule.primary_pattern.MatchesAllHosts()) {
secondary_pattern = ContentSettingsPattern::FromString(
"*://[*.]" + rule.primary_pattern.GetHost() + "/*");
Copy link
Contributor

Choose a reason for hiding this comment

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

@bridiver can you say a bit about whats going on here. Both google.com and googleapis.com should be diff eTLD+1, so I think should be unrelated to dealing with private registries

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@pes10k pulling in your changes was an accident because I was already on your branch

@bridiver bridiver force-pushed the 3rd-party-cookie-registry-domains branch from ad0a278 to 6e865b4 Compare April 27, 2020 19:08
@bridiver bridiver requested a review from iefremov as a code owner April 27, 2020 19:08
@bridiver bridiver force-pushed the 3rd-party-cookie-registry-domains branch from 6e865b4 to 1adf0af Compare April 27, 2020 22:20

domain_registry_url_ = embedded_test_server()->GetURL("mobile.twitter.com",
"/cookie_iframe.html");
iframe_domain_registry_url_ = embedded_test_server()->GetURL("blah.twitter.com",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for some reason when I just used "twitter.com" it would hang forever loading, but this serves the same purpose


namespace content_settings {

namespace {

Rule CloneRule(const Rule& rule, bool reverse_patterns = false) {
auto secondary_pattern = rule.secondary_pattern;
if (secondary_pattern ==
// brave plugin rules incorrectly use first party url as primary
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it was confusing to flip things back and forth so I reversed them at the start instead and rephrased the comment

Copy link
Contributor

Choose a reason for hiding this comment

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

As for me it became more confusing, because now I need to keep in mind that primary/secondary are probably not what they mean. Maybe renaming to reversed_primary/reversed_secondary would help

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually they are what they mean now, before it was confusing because they were reversed at the end of the method

Copy link
Contributor

Choose a reason for hiding this comment

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

still I would rename them. Maybe new_primary and new_secondary, or cloned_primary etc

domain_registry_url_ = embedded_test_server()->GetURL("mobile.twitter.com",
"/cookie_iframe.html");
iframe_domain_registry_url_ =
embedded_test_server()->GetURL("blah.twitter.com",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for some reason just using "twitter.com" would fail to load in the test server, but this serves the same purpose

@bridiver bridiver self-assigned this Apr 27, 2020
@bridiver bridiver force-pushed the 3rd-party-cookie-registry-domains branch from a40231a to 340dc92 Compare April 28, 2020 04:39
if (!rule.primary_pattern.MatchesAllHosts()) {
secondary_pattern = ContentSettingsPattern::FromString(
"*://[*.]" + rule.primary_pattern.GetHost() + "/*");
DCHECK(reverse_patterns); // we should only hit this for brave plugin rules
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we still run tests without DCHECKs - mb just for curiosity add DumpWithoutCrashing() here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I ran locally with dcheck enabled

@bridiver bridiver merged commit f3700fa into master Apr 28, 2020
@bridiver bridiver deleted the 3rd-party-cookie-registry-domains branch April 28, 2020 15:03
bsclifton pushed a commit that referenced this pull request Apr 28, 2020
3rd party cookie registry domains

This excludes changes to `browser/net/brave_network_delegate_browsertest.cc`
bsclifton pushed a commit that referenced this pull request Apr 28, 2020
3rd party cookie registry domains

This excludes changes to `browser/net/brave_network_delegate_browsertest.cc`
@kjozwiak
Copy link
Member

kjozwiak commented May 1, 2020

Reproduced the original issue with Samsung S10+ running Android 10 using the follolwing:

1.5.131 CR: 80.0.3987.162

Screenshot_20200501-170742_Brave

Verification PASSED with Samsung S10+ using Android 10 running the following build:

1.10.22 CR: 81.0.4044.129

STR:

  • open twitter.com and disable Block 3rd party cookies via shields
  • login into Twitter
  • enable/disable Block 3rd party cookies several times

@srirambv
Copy link
Contributor

srirambv commented May 4, 2020

Verification passed on 1.10.22 xr64 nightly build

  • Verified page loads correctly without any errors
  • Verified page loads correctly when Cookies setting is toggled
  • Verified loading desktop page doesn't cause any issue

@kjozwiak kjozwiak added this to the 1.10.x - Nightly milestone May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] Toggling 3p cookie settings breaks Twitter
5 participants