Skip to content

firmis validate - Validate Rule Files

Terminal window
firmis validate [rules...] [options]

A rule with a broken regex does not fail loudly - it just stops matching. firmis validate catches typos, invalid patterns, and schema errors in your YAML rule files before they create silent gaps in your detection coverage.

Pass one or more rule files or directories. Firmis checks each file for YAML syntax errors, schema compliance (required fields present and correctly typed), and regex compilation. Every regex, file-access, and network pattern is compiled via JavaScript RegExp to confirm it is valid. In --strict mode, regex compilation warnings are promoted to errors, making the command suitable as a CI gate for your rule library.

Use --built-in to validate Firmis’s 324 built-in rules. This is useful after a version upgrade to confirm nothing regressed.

At least one argument ([rules...]) or --built-in must be provided. If neither is given, the command prints usage and exits with code 1.

firmis validate is read-only. It does not modify any files.

Validate a custom rule file before committing

Section titled “Validate a custom rule file before committing”
Terminal
npx firmis validate rules/custom/my-rules.yaml
Terminal
npx firmis validate rules/custom/

Validate built-in rules after a version upgrade

Section titled “Validate built-in rules after a version upgrade”
Terminal
npx firmis validate --built-in

Validate in strict mode for CI (warnings become errors)

Section titled “Validate in strict mode for CI (warnings become errors)”
Terminal
npx firmis validate rules/custom/ --built-in --strict
Terminal
npx firmis validate rules/ && npx firmis-cli scan --config .firmisrc
FlagTypeDefaultDescription
--strictbooleanfalseTreat regex warnings as errors. Recommended before shipping rules to production or adding validate as a CI gate.
--built-inbooleanfalseAlso validate Firmis’s 324 built-in rules. Useful after upgrading to confirm no rules regressed.
CodeMeaning
0All validated rule files are valid.
1One or more rule files have errors.
1--strict is set and one or more regex warnings were found.
1No paths specified and --built-in not set.
  • Custom Rules - how to write your own YAML detection rules
  • Rules Overview - how the rule engine evaluates patterns and assigns confidence scores
  • policy validate - validate a policy YAML file (separate from rule validation)