Validating YAML files
When using the Detection Rules as Code feature, you can use the API to check that your detection rules are valid and the tests pass in Scanner before checking them into Github.
We have the following APIs for validating detection rules and running detection rule tests.
Note: this API is for a beta feature, and may be subject to change.
Validate detection rule
POST
/v1/detection_rule_yaml/validate
Validate a detection rule YAML.
Example
Response
Returns whether the detection rule is_valid
and any error
messages. error
is null
if the detection rule is valid.
Run detection rule tests
POST
/v1/detection_rule_yaml/run_tests
Run tests specified in the given detection rule YAML.
Example
Response
Returns results
, a map of test names to their corresponding status (passed or failed). results
is empty if there are no tests found in the given file.
Last updated