mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 06:44:51 +02:00
Don't validate RDAP nameserver names using validateDomainName
The nameserver may be external, in which case its TLD will not appear in our list of valid TLDs, and the search will be rejected erroneously. Tests for letter case canonicalizations also added at reviewer's suggestion. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171985702
This commit is contained in:
parent
9d1eb0d429
commit
326cf698e0
15 changed files with 113 additions and 91 deletions
|
@ -14,15 +14,18 @@
|
|||
|
||||
package google.registry.rdap;
|
||||
|
||||
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.request.Action.Method.GET;
|
||||
import static google.registry.request.Action.Method.HEAD;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
|
||||
import google.registry.request.Action;
|
||||
import google.registry.request.HttpException.BadRequestException;
|
||||
import google.registry.request.HttpException.NotFoundException;
|
||||
import google.registry.request.auth.Auth;
|
||||
import google.registry.util.Clock;
|
||||
|
@ -59,7 +62,14 @@ public class RdapNameserverAction extends RdapActionBase {
|
|||
DateTime now = clock.nowUtc();
|
||||
pathSearchString = canonicalizeName(pathSearchString);
|
||||
// The RDAP syntax is /rdap/nameserver/ns1.mydomain.com.
|
||||
validateDomainName(pathSearchString);
|
||||
try {
|
||||
validateHostName(pathSearchString);
|
||||
} catch (EppException e) {
|
||||
throw new BadRequestException(
|
||||
String.format(
|
||||
"%s is not a valid %s: %s",
|
||||
pathSearchString, getHumanReadableObjectTypeName(), e.getMessage()));
|
||||
}
|
||||
// If there are no undeleted nameservers with the given name, the foreign key should point to
|
||||
// the most recently deleted one.
|
||||
HostResource hostResource =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue