mirror of
https://github.com/google/nomulus.git
synced 2025-07-08 20:23:24 +02:00
Remove platformType and threatEntryMetaData fields from ThreatMatch (#607)
* Remove platformType and threatEntryMetaData fields from ThreatMatch * Run google-java-format on both files * Add test for removal of unnecessary fields * Removed unnecessary fields from Spec11PipelineTest.testEndToEndPipeline_generatesExpectedFiles * Added style check * Fix typo
This commit is contained in:
parent
b1241b98b2
commit
5a1f3d0376
4 changed files with 24 additions and 36 deletions
|
@ -195,14 +195,10 @@ public class Spec11PipelineTest {
|
|||
new JSONObject()
|
||||
.put("fullyQualifiedDomainName", "111.com")
|
||||
.put("threatType", "MALWARE")
|
||||
.put("threatEntryMetadata", "NONE")
|
||||
.put("platformType", "WINDOWS")
|
||||
.toString(),
|
||||
new JSONObject()
|
||||
.put("fullyQualifiedDomainName", "222.com")
|
||||
.put("threatType", "MALWARE")
|
||||
.put("threatEntryMetadata", "NONE")
|
||||
.put("platformType", "WINDOWS")
|
||||
.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,26 @@ public class Spec11RegistrarThreatMatchesParserTest {
|
|||
.hasValue(LocalDate.parse("2018-07-14"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_ignoreExtraFields() throws Exception {
|
||||
ThreatMatch objectWithExtraFields =
|
||||
ThreatMatch.fromJSON(
|
||||
new JSONObject(
|
||||
ImmutableMap.of(
|
||||
"threatType", "MALWARE",
|
||||
"platformType", "ANY_PLATFORM",
|
||||
"threatEntryMetaData", "NONE",
|
||||
"fullyQualifiedDomainName", "c.com")));
|
||||
ThreatMatch objectWithoutExtraFields =
|
||||
ThreatMatch.fromJSON(
|
||||
new JSONObject(
|
||||
ImmutableMap.of(
|
||||
"threatType", "MALWARE",
|
||||
"fullyQualifiedDomainName", "c.com")));
|
||||
|
||||
assertThat(objectWithExtraFields).isEqualTo(objectWithoutExtraFields);
|
||||
}
|
||||
|
||||
/** The expected contents of the sample spec11 report file */
|
||||
static ImmutableSet<RegistrarThreatMatches> sampleThreatMatches() throws Exception {
|
||||
return ImmutableSet.of(getMatchA(), getMatchB());
|
||||
|
@ -90,8 +110,6 @@ public class Spec11RegistrarThreatMatchesParserTest {
|
|||
new JSONObject(
|
||||
ImmutableMap.of(
|
||||
"threatType", "MALWARE",
|
||||
"platformType", "ANY_PLATFORM",
|
||||
"threatEntryMetadata", "NONE",
|
||||
"fullyQualifiedDomainName", "a.com")))));
|
||||
}
|
||||
|
||||
|
@ -103,15 +121,11 @@ public class Spec11RegistrarThreatMatchesParserTest {
|
|||
new JSONObject(
|
||||
ImmutableMap.of(
|
||||
"threatType", "MALWARE",
|
||||
"platformType", "ANY_PLATFORM",
|
||||
"threatEntryMetadata", "NONE",
|
||||
"fullyQualifiedDomainName", "b.com"))),
|
||||
ThreatMatch.fromJSON(
|
||||
new JSONObject(
|
||||
ImmutableMap.of(
|
||||
"threatType", "MALWARE",
|
||||
"platformType", "ANY_PLATFORM",
|
||||
"threatEntryMetadata", "NONE",
|
||||
"fullyQualifiedDomainName", "c.com")))));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Map from registrar email / name to detected subdomain threats:
|
||||
{"threatMatches":[{"threatEntryMetadata":"NONE","threatType":"MALWARE","fullyQualifiedDomainName":"a.com","platformType":"ANY_PLATFORM"}],"registrarClientId":"TheRegistrar","registrarEmailAddress":"the.registrar@example.com"}
|
||||
{"threatMatches":[{"threatEntryMetadata":"NONE","threatType":"MALWARE","fullyQualifiedDomainName":"b.com","platformType":"ANY_PLATFORM"},{"threatEntryMetadata":"NONE","threatType":"MALWARE","fullyQualifiedDomainName":"c.com","platformType":"ANY_PLATFORM"}],"registrarClientId":"NewRegistrar","registrarEmailAddress":"new.registrar@example.com"}
|
||||
{"threatMatches":[{"threatType":"MALWARE","fullyQualifiedDomainName":"a.com"}],"registrarClientId":"TheRegistrar","registrarEmailAddress":"the.registrar@example.com"}
|
||||
{"threatMatches":[{"threatType":"MALWARE","fullyQualifiedDomainName":"b.com"},{"threatType":"MALWARE","fullyQualifiedDomainName":"c.com"}],"registrarClientId":"NewRegistrar","registrarEmailAddress":"new.registrar@example.com"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue