rsigma config validate

rsigma config validate

Added in v0.14.0

Load every config layer that would apply at runtime and report problems before they cause a daemon or eval to misbehave.

Synopsis

rsigma config validate [--config <PATH>] [--format <text|json>]

Description

Walks the same discovery chain the daemon and eval commands use, deserializes every layer, and reports:

  • Unknown keys that don’t match the schema (typo guard). Each one fails validation with exit 3. Unreleased
  • Inactive sections that are set but inert in this build because the gating Cargo feature is disabled (daemon without the daemon feature, daemon.nats without daemon-nats, daemon.api.tls without daemon-tls, daemon.stix_store without stix-enrich). Every command that reads the config warns about them, and they never fail a command. daemon.stix_store Unreleased
  • Errors that prevent a file from loading at all.
  • Ruleset errors from statically checking every declared ruleset: unknown keys, an empty sources list, invalid globs, unknown levels, statuses, kinds, and policies, and malformed overlays. Sources are not read, so a missing source, an unresolved correlation reference, or an overlay that matches nothing surfaces when the ruleset is resolved, for example by ruleset show or ruleset build. Unreleased
  • Ruleset list errors in eval.ruleset, eval.rulesets, and daemon.rulesets: undefined or duplicate names, unknown entry or when keys, and a list combined with rules (or eval.ruleset with eval.rulesets). Schema names in when are checked when engine eval or engine daemon loads the classifier, because --schema-config can add schemas. Unreleased
  • Convert group errors in convert.groups: invalid group names, a missing or undefined ruleset, a missing target or output after convert.defaults is applied, and two groups that write the same output or manifest. Unreleased

Unknown keys and ruleset errors always fail validation with exit 3, so CI can gate on configuration cleanliness without extra flags. Every other command that reads the config stops with the same exit code on an unknown key. Unreleased

Flags

Flag Default Description
-c, --config <PATH> discovery chain Load only this file (bypasses discovery).
--format <text|json> text when unset Human-readable summary on stderr or a machine-readable envelope on stdout. When unset, the global --output-format is used (json/ndjson/table/csv/tsv). Local --format wins over the global selector and prints a precedence warning. See Output Formats.
--strict off Deprecated. Accepted for compatibility and changes nothing, because unknown keys always fail validation. Hidden from --help. Unreleased

Output

Text mode

Diagnostics go to stderr. Loaded layers are listed in increasing precedence order, then each unknown key, ignored key, and inactive section is printed, followed by a summary line.

Loaded (low to high precedence):
  - /etc/rsigma/config.yaml
  - ./rsigma.yaml
error: unknown key 'bogus_key' in ./rsigma.yaml
warning: ignoring 'mcp.daemon_url' from project config ./rsigma.yaml; security-sensitive keys are read only from --config, the user or system config, environment variables, or flags
1 unknown key(s) found

An ignored key is a security-sensitive key set in a project file (./rsigma.yaml or .rsigmarc), which rsigma drops; see Project config trust. Ignored keys do not fail validation. Added in v0.27.0

JSON mode

A single envelope is written to stdout (data goes to stdout; warnings stay on stderr only in text mode).

{
  "ok": false,
  "sources": ["/etc/rsigma/config.yaml", "./rsigma.yaml"],
  "unknown_keys": [
    { "file": "./rsigma.yaml", "key": "bogus_key" }
  ],
  "ignored_keys": [
    { "file": "./rsigma.yaml", "key": "mcp.daemon_url" }
  ],
  "inactive_sections": [],
  "semantic_errors": [
    { "path": "rulesets.linux_edge", "message": "ruleset 'linux_edge': unknown key 'exlude' (did you mean 'exclude'?)" },
    { "path": "convert.groups.linux_edge_lynxdb", "message": "convert group 'linux_edge_lynxdb' names unknown ruleset 'linux_edg'" }
  ]
}

ignored_keys Added in v0.27.0 lists the protected keys dropped from project files. Table, CSV, TSV, and NDJSON output report each one as an ignored_key row. semantic_errors Unreleased reports each problem found in a ruleset spec, a ruleset list, or a convert group, as {path, message}, where path is the dotted config path such as rulesets.linux_edge, eval.rulesets, or convert.groups.linux_edge_lynxdb.

A failure surfaces "ok": false and (for parse failures) an "error" field.

Exit codes

Code Meaning
0 Config loaded successfully with no unknown keys and no ruleset errors.
3 A file could not be read or parsed, a file has an unknown key, or a ruleset spec is invalid.

Examples

Check the discovered config:

rsigma config validate

Validate a specific file and fail the build on typos:

rsigma config validate -c rsigma.yaml

Use the JSON envelope from a CI step:

rsigma config validate --format json | jq -e '.ok'

See also