1
0
mirror of https://github.com/google/nomulus synced 2026-06-09 16:33:02 +00:00

Don't allow generation of allocation tokens for invalid domain names (#327)

* Address comments

* Delete client name change

* Delete skaffold.yaml
This commit is contained in:
sarahcaseybot
2019-11-01 12:19:10 -04:00
committed by GitHub
parent aaca6651c8
commit 6f87fc115f
6 changed files with 217 additions and 3 deletions

View File

@@ -35,6 +35,8 @@ import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.Mapify;
import google.registry.flows.EppException;
import google.registry.flows.domain.DomainFlowUtils;
import google.registry.model.BackupGroupRoot;
import google.registry.model.Buildable;
import google.registry.model.CreateAutoTimestamp;
@@ -201,6 +203,13 @@ public class AllocationToken extends BackupGroupRoot implements Buildable {
getInstance().redemptionHistoryEntry == null
|| TokenType.SINGLE_USE.equals(getInstance().tokenType),
"Redemption history entry can only be specified for SINGLE_USE tokens");
if (getInstance().domainName != null) {
try {
DomainFlowUtils.validateDomainName(getInstance().domainName);
} catch (EppException e) {
throw new IllegalArgumentException("Invalid domain name: " + getInstance().domainName, e);
}
}
return super.build();
}