Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -65,9 +65,11 @@ private boolean isAllowedDomain(String domain) {
if (StringUtils.isBlank(domain)) {
return true;
}
// Some services may not have correct path set, so it may be a malformed URL
var domainToCheck = domain.endsWith("null") ? domain.substring(0, domain.lastIndexOf("null")) : domain;
return allowedDomainsSet.stream().anyMatch(allowedDomain -> {
try {
return isAllowed(allowedDomain, domain);
return isAllowed(allowedDomain, domainToCheck);
} catch (MalformedURLException e) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ void setUp() throws Exception {
"apiml.customKey, https://invalid.org:8080, true",
"apiml.documentationUrl, invalid-url, false",
"apiml.externalUrl, HTTPS://LOCALHOST:8080, true",
"apiml.externalUrl, HTTPS://INVALID.ORG:8080, false"
"apiml.externalUrl, HTTPS://INVALID.ORG:8080, false",
"apiml.externalUrl, https://invalid.org:8080null, false",
"apiml.externalUrl, https://localhost:8080null, true"
})
void shouldVerifyMetadataKeysAndDomains(String metadataKey, String metadataValue, boolean isAllowed) throws Exception {
Map<String, String> metadata = new HashMap<>();
Expand Down
Loading