diff --git a/pom.xml b/pom.xml index 4ed4f8a..3c8338d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ io.digitalstate.stix stix - v0.6 + v0.6.1 jar STIX 2 @@ -65,7 +65,6 @@ 2.4.0 - org.hibernate.validator hibernate-validator @@ -125,6 +124,7 @@ org.codehaus.groovy groovy-all 2.4.15 + test net.bytebuddy @@ -174,7 +174,7 @@ - compile + compileTests diff --git a/src/main/java/io/digitalstate/stix/common/StixModified.java b/src/main/java/io/digitalstate/stix/common/StixModified.java index e8e0c85..fabdb3f 100644 --- a/src/main/java/io/digitalstate/stix/common/StixModified.java +++ b/src/main/java/io/digitalstate/stix/common/StixModified.java @@ -19,7 +19,7 @@ public interface StixModified { @NotNull @JsonProperty("modified") @JsonPropertyDescription("The modified property represents the time that this particular version of the object was created. The timstamp value MUST be precise to the nearest millisecond.") - @JsonFormat(pattern = StixDataFormats.TIMESTAMP_PATTERN, timezone = "UTC") + @JsonFormat(pattern = StixDataFormats.TIMESTAMP_PATTERN, timezone = "UTC") @Value.Default @Redactable default Instant getModified(){ diff --git a/src/main/java/io/digitalstate/stix/coo/objects/ProcessCoo.java b/src/main/java/io/digitalstate/stix/coo/objects/ProcessCoo.java index 7582aee..d07f49c 100644 --- a/src/main/java/io/digitalstate/stix/coo/objects/ProcessCoo.java +++ b/src/main/java/io/digitalstate/stix/coo/objects/ProcessCoo.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import io.digitalstate.stix.coo.CyberObservableObject; +import io.digitalstate.stix.helpers.StixDataFormats; import io.digitalstate.stix.validation.contraints.businessrule.BusinessRule; import io.digitalstate.stix.validation.contraints.defaulttypevalue.DefaultTypeValue; import io.digitalstate.stix.validation.groups.DefaultValuesProcessor; @@ -35,7 +36,7 @@ @JsonPropertyOrder({ "type", "extensions", "is_hidden", "pid", "name", "created", "cwd", "arguments", "command_line", "environment_variables", "opened_connection_refs", "creator_user_ref", "binary_ref", "parent_ref", "child_refs" }) -@BusinessRule(ifExp = "true", thenExp = "getExtensions().isEmpty() == false || isHidden().isPresent() == true || getPid().isPresent() == true || getName().isPresent() == true || getCreated().isPresent() == true || getCwd().isPresent() == true || getArguments().isEmpty() == false || getCommandLine().isPresent() == true || getEnvironmentVariables().isEmpty() == false || getOpenedConnectionRefs().isEmpty() == false || getCreatorUserRef().isPresent() == true || getBinaryRef().isPresent() == true || getParentRef().isPresent() == true || getChildRefs().isEmpty == false", errorMessage = "A Process Object MUST contain at least one property (other than type) from this object (or one of its extensions).") +@BusinessRule(ifExp = "true", thenExp = "getExtensions().isEmpty() == false || isHidden().isPresent() == true || getPid().isPresent() == true || getName().isPresent() == true || getCreated().isPresent() == true || getCwd().isPresent() == true || getArguments().isEmpty() == false || getCommandLine().isPresent() == true || getEnvironmentVariables().isEmpty() == false || getOpenedConnectionRefs().isEmpty() == false || getCreatorUserRef().isPresent() == true || getBinaryRef().isPresent() == true || getParentRef().isPresent() == true || getChildRefs().isEmpty() == false", errorMessage = "A Process Object MUST contain at least one property (other than type) from this object (or one of its extensions).") public interface ProcessCoo extends CyberObservableObject { @JsonProperty("is_hidden") @@ -53,6 +54,7 @@ public interface ProcessCoo extends CyberObservableObject { @JsonProperty("created") @JsonPropertyDescription("Specifies the date/time at which the process was created.") + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern = StixDataFormats.TIMESTAMP_PATTERN, timezone = "UTC") Optional getCreated(); @JsonProperty("cwd") diff --git a/src/test/groovy/stix/sdo/ObservedDataSpec.groovy b/src/test/groovy/stix/sdo/ObservedDataSpec.groovy index 005ea4a..f403295 100644 --- a/src/test/groovy/stix/sdo/ObservedDataSpec.groovy +++ b/src/test/groovy/stix/sdo/ObservedDataSpec.groovy @@ -43,6 +43,6 @@ class ObservedDataSpec extends Specification implements StixMockDataGenerator { JSONAssert.assertEquals(originalJsonString, newJsonString, JSONCompareMode.NON_EXTENSIBLE) where: - i << (1..1000) // More tests are run because of the large variation of probabilities and number of combinations + i << (1..5000) // More tests are run because of the large variation of probabilities and number of combinations } } diff --git a/src/test/groovy/stix/sdo/ReportSpec.groovy b/src/test/groovy/stix/sdo/ReportSpec.groovy index b0abd6b..4d4c907 100644 --- a/src/test/groovy/stix/sdo/ReportSpec.groovy +++ b/src/test/groovy/stix/sdo/ReportSpec.groovy @@ -43,6 +43,6 @@ class ReportSpec extends Specification implements StixMockDataGenerator { JSONAssert.assertEquals(originalJsonString, newJsonString, JSONCompareMode.NON_EXTENSIBLE) where: - i << (1..100) // More tests are run because of the large variation of probabilities and number of combinations + i << (1..500) // More tests are run because of the large variation of probabilities and number of combinations } }