Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #1042: Implement DomainAndRegistry for eTLD+1 #5239

Merged
merged 3 commits into from
Apr 21, 2022

Conversation

Brandon-T
Copy link
Collaborator

@Brandon-T Brandon-T commented Apr 11, 2022

Security Review

Summary of Changes

  • Implement domainAndRegistry and domainAndRegistryExcludingPrivateRegistries.
  • Implement registry (public suffix)
  • Our Unit tests and Brave-Core's unit tests are up to date.

This pull request fixes #1042

Submitter Checklist:

  • Unit Tests are updated to cover new or changed functionality
  • User-facing strings use NSLocalizableString()

Test Plan:

image

- Test Sharing a URL (youtube, twitter, bbc.co.uk, etc) - Test History and recent searches showing properly (also test recent searches not different from previous build when upgrading) - Test BraveNews still works

Reviewer Checklist:

  • Issues include necessary QA labels:
    • QA/(Yes|No)
    • bug / enhancement
  • Necessary security reviews have taken place.
  • Adequate unit test coverage exists to prevent regressions.
  • Adequate test plan exists for QA to validate (if applicable).
  • Issue and pull request is assigned to a milestone (should happen at merge time).

@cuba
Copy link
Contributor

cuba commented Apr 11, 2022

Is there any way we can expose a way to extract an etld from a host string and not a url? I suppose I can cheat a bit and create a url with a fixed scheme if not.

@iccub
Copy link
Contributor

iccub commented Apr 11, 2022

Merging this one after security review passes, any subsequent improvements to the url helper methods will be handled as new tickets cc @cuba

Copy link
Contributor

@cuba cuba left a comment

Choose a reason for hiding this comment

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

Left some comments that are minor but other than that I'll let you judge the best direction.

XCTAssertEqual("d.kawasaki.jp", expected)
XCTAssertEqual("d.kawasaki.jp", url.host?.publicSuffix)
}

func testExceptionDomain() {
// TLD Entry: !city.kawasaki.jp
let url = "http://city.kawasaki.jp".asURL!
let expected = url.publicSuffix!
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe remove that ! You're testing it's not nil so I don't think you should put that ! there plus you don't really need it. Both would result in a failed test but one will give you some better test information.

@@ -144,41 +179,47 @@ class NSURLExtensionsTests: XCTestCase {
let url = "http://bbc.co.uk".asURL!
let expected = url.baseDomain!
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above and all the rest below.

@Brandon-T Brandon-T requested a review from thypon April 19, 2022 13:59
@Brandon-T Brandon-T merged commit 120c314 into development Apr 21, 2022
@Brandon-T Brandon-T deleted the bugfix/eTLDPlus1 branch April 21, 2022 20:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a mechanism to auto update eTLD dat file before release
5 participants