Fix Spec11 domain check (#1105)

* Fix Spec11 domain check

We should be checking to see if there are _any_ active domains for a given
reported domain, not to see if _the_ domain for the name is active.

The last change caused an exception for domains with soft-deleted past domains
of the same name.  The original code only checked the first domain returned
from the query, which may have been soft-deleted.  This version checks all
domain records to see if any are active.

* filter().count() -> anyMatch()
This commit is contained in:
Michael Muller
2021-04-23 14:20:31 -04:00
committed by GitHub
parent 9f69a0bf2e
commit 9c89643367
2 changed files with 47 additions and 3 deletions
@@ -136,13 +136,14 @@ public class Spec11EmailUtils {
return registrarThreatMatches.threatMatches().stream()
.filter(
threatMatch ->
tm().createQueryComposer(DomainBase.class)
tm()
.createQueryComposer(DomainBase.class)
.where(
"fullyQualifiedDomainName",
Comparator.EQ,
threatMatch.fullyQualifiedDomainName())
.getSingleResult()
.shouldPublishToDns())
.stream()
.anyMatch(DomainBase::shouldPublishToDns))
.collect(toImmutableList());
});
return RegistrarThreatMatches.create(registrarThreatMatches.clientId(), filteredMatches);