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

Sub domains should not match #6952

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ private boolean isEqual(String str1, String str2) {

@Override
protected boolean hostMatches(String registered, String requested) {
return isEqual(registered, requested) || (requested != null && requested.endsWith("." + registered));
return isEqual(registered, requested);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ private void redirectUriGeneralTest() {

@Test
public void redirectMatches_AllowMatchingSubdomainsTest() {
// Temp: Subdomain should match if the togglz is OFF
assertTrue(resolver.redirectMatches("https://www.orcid.org", "https://orcid.org"));
assertTrue(resolver.redirectMatches("https://qa.orcid.org", "https://orcid.org"));
// Subdomain should not match
assertFalse(resolver.redirectMatches("https://www.orcid.org", "https://orcid.org"));
assertFalse(resolver.redirectMatches("https://qa.orcid.org", "https://orcid.org"));

// Acceptance criteria checks: These should pass when the togglz is OFF
assertTrue(resolver.redirectMatches("https://subdomain.example.com/", "https://example.com"));
assertTrue(resolver.redirectMatches("https://subdomain.example.com/subdirectory", "https://example.com"));
assertTrue(resolver.redirectMatches("https://www.example.com", "https://example.com"));
// Acceptance criteria checks: subdomains should be rejected
assertFalse(resolver.redirectMatches("https://subdomain.example.com/", "https://example.com"));
assertFalse(resolver.redirectMatches("https://subdomain.example.com/subdirectory", "https://example.com"));
assertFalse(resolver.redirectMatches("https://www.example.com", "https://example.com"));
}

}