@@ -907,6 +907,78 @@ public void testConvertUnboundValuesAsWildcard() throws IOException, SigmaError
907
907
Assert .assertEquals ("((mappedA: \" value1\" ) OR (mappedA: \" value2\" ) OR (mappedA: \" value3\" )) OR (test*)" , queries .get (0 ).toString ());
908
908
}
909
909
910
+ public void testConvertSkipEmptyStringStartsWithModifier () throws IOException , SigmaError {
911
+ OSQueryBackend queryBackend = testBackend ();
912
+ Assert .assertThrows (SigmaValueError .class , () -> {
913
+ queryBackend .convertRule (SigmaRule .fromYaml (
914
+ " title: Test\n " +
915
+ " id: 39f919f3-980b-4e6f-a975-8af7e507ef2b\n " +
916
+ " status: test\n " +
917
+ " level: critical\n " +
918
+ " description: Detects QuarksPwDump clearing access history in hive\n " +
919
+ " author: Florian Roth\n " +
920
+ " date: 2017/05/15\n " +
921
+ " logsource:\n " +
922
+ " category: test_category\n " +
923
+ " product: test_product\n " +
924
+ " detection:\n " +
925
+ " sel:\n " +
926
+ " fieldA1|startswith: \n " +
927
+ " - value1\n " +
928
+ " - value2\n " +
929
+ " - ''\n " +
930
+ " condition: sel" , false ));
931
+ });
932
+ }
933
+
934
+ public void testConvertSkipEmptyStringEndsWithModifier () throws IOException , SigmaError {
935
+ OSQueryBackend queryBackend = testBackend ();
936
+ Assert .assertThrows (SigmaValueError .class , () -> {
937
+ queryBackend .convertRule (SigmaRule .fromYaml (
938
+ " title: Test\n " +
939
+ " id: 39f919f3-980b-4e6f-a975-8af7e507ef2b\n " +
940
+ " status: test\n " +
941
+ " level: critical\n " +
942
+ " description: Detects QuarksPwDump clearing access history in hive\n " +
943
+ " author: Florian Roth\n " +
944
+ " date: 2017/05/15\n " +
945
+ " logsource:\n " +
946
+ " category: test_category\n " +
947
+ " product: test_product\n " +
948
+ " detection:\n " +
949
+ " sel:\n " +
950
+ " fieldA1|endswith: \n " +
951
+ " - value1\n " +
952
+ " - value2\n " +
953
+ " - ''\n " +
954
+ " condition: sel" , false ));
955
+ });
956
+ }
957
+
958
+ public void testConvertSkipEmptyStringContainsModifier () throws IOException , SigmaError {
959
+ OSQueryBackend queryBackend = testBackend ();
960
+ Assert .assertThrows (SigmaValueError .class , () -> {
961
+ queryBackend .convertRule (SigmaRule .fromYaml (
962
+ " title: Test\n " +
963
+ " id: 39f919f3-980b-4e6f-a975-8af7e507ef2b\n " +
964
+ " status: test\n " +
965
+ " level: critical\n " +
966
+ " description: Detects QuarksPwDump clearing access history in hive\n " +
967
+ " author: Florian Roth\n " +
968
+ " date: 2017/05/15\n " +
969
+ " logsource:\n " +
970
+ " category: test_category\n " +
971
+ " product: test_product\n " +
972
+ " detection:\n " +
973
+ " sel:\n " +
974
+ " fieldA1|contains: \n " +
975
+ " - value1\n " +
976
+ " - value2\n " +
977
+ " - ''\n " +
978
+ " condition: sel" , false ));
979
+ });
980
+ }
981
+
910
982
private OSQueryBackend testBackend () throws IOException {
911
983
return new OSQueryBackend (testFieldMapping , false , true );
912
984
}
0 commit comments