Schema definition clarification/mod needed
The schema defines condition as str.
Yet it is mentioned in the specs that
If multiple conditions are given, they are logically linked with OR.
without defining how could that be possible... the only example I found was (https://github.com/Neo23x0/sigma/blob/master/rules/network/net_susp_network_scan.yml).
So, either:
- A) Update the schema to mention that
conditioncould be either astrorlist, - B)
conditionremains astrand fix the parser (sigmac?) to allow for multiple pipes/parentheses/ORs, or - C) fix
conditionto be alistand update all rules accordingly (all existing rules will have a single-item list for their condition)
Sorry for being picky :D, working on something which will have a sigma rule parser and being consistent is a good base to build on...
P.S: Changing the above mentioned rule from
condition:
- selection | count(dst_port) by src_ip > 10
- selection | count(dst_ip) by src_ip > 10
to
condition: ( selection | count(dst_port) by src_ip > 10 ) or ( selection | count(dst_ip) by src_ip > 10 )
broke sigmac, complaining about unmatched closing parentheses (maybe because it improperly parses after the pipe token)
P.P.S: I'll gladly update all rules to match whatever decision will be made.
Actually there are few discrepancies between the schema and the rules every now and then ... author is defined as str, but here it's a list:
https://github.com/Neo23x0/sigma/blob/master/rules/windows/sysmon/sysmon_susp_certutil_command.yml
Sorry for bringing this over and over, I already do check for those issues in the code that parses the rules, but consistency between the schema and the sample rules will make a better case for wider sigma adoption.
Factually, sigmac currently implements A, but the specification defines str. Fixing it to str and adding the or syntax to conditions would make the parsing harder and the condition harder to read in my opinion. Same for author: list-only would add unneeded single-item lists to many rules while str-only will make rules with multiple authors unstructured.
On the whole, I think we should keep this flexibility in Sigma and allow str and list. Unfortunately, the used Schema language (Kwalify) doesn't support such alternatives, while Rx does. A switch to Rx could give us this flexibility. I discuss this with Florian.
Ok, following plan: we switch to a Rx schema definition with alternatives.
Schema has updated to Rx schema with possibilities for strings and lists of strings mentioned above.