mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 03:57:51 +02:00
Validate potentially-invalid domain names when (un)locking domains (#698)
* Validate potentially-invalid domain names when (un)locking domains
This commit is contained in:
parent
11eeda4233
commit
d10aea2ff1
2 changed files with 12 additions and 0 deletions
|
@ -30,6 +30,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.gson.Gson;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.flows.domain.DomainFlowUtils;
|
||||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registrar.RegistrarContact;
|
||||
import google.registry.request.Action;
|
||||
|
@ -118,6 +119,7 @@ public class RegistryLockPostAction implements Runnable, JsonActionRunner.JsonAc
|
|||
String registrarId = postInput.registrarId;
|
||||
checkArgument(!Strings.isNullOrEmpty(registrarId), "Missing key for registrarId");
|
||||
checkArgument(!Strings.isNullOrEmpty(postInput.domainName), "Missing key for domainName");
|
||||
DomainFlowUtils.validateDomainName(postInput.domainName);
|
||||
checkNotNull(postInput.isLock, "Missing key for isLock");
|
||||
UserAuthInfo userAuthInfo =
|
||||
authResult
|
||||
|
|
|
@ -280,6 +280,16 @@ public final class RegistryLockPostActionTest {
|
|||
assertFailureWithMessage(response, "Missing key for domainName");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_nonPunycodeDomainName() {
|
||||
Map<String, ?> response = action.handleJsonRequest(ImmutableMap.of(
|
||||
"isLock", true,
|
||||
"registrarId", "TheRegistrar",
|
||||
"domainName", "example.みんな",
|
||||
"password", "hi"));
|
||||
assertFailureWithMessage(response, "Domain names can only contain a-z, 0-9, '.' and '-'");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_noLockParam() {
|
||||
Map<String, ?> response =
|
||||
|
|
Loading…
Add table
Reference in a new issue