verdictan policy lint
verdictan policy lint checks one document before you publish it. In runtime mode, it checks a policy config against the declarative config schema and the cross-field rules of the gateway. In abac mode, it checks the statements of a permission policy document. The command runs locally and does not call the API.
Usage
verdictan policy lint [--file <path>] [--mode <auto|runtime|abac>]Options
| Flag | Description |
|---|---|
--file <path> | Document to check. The default is policy-config.yaml. |
--mode <auto|runtime|abac> | Lint mode. The default is auto. |
In auto mode, the command reads the file and selects abac when the top level has a policies array, a statements key, or a Statement key. Otherwise it selects runtime. It parses a .json file as JSON and every other file as YAML.
Validate a gateway configuration
verdictan policy lint --mode runtime --file policy-config.yamlWhen the file passes, the command prints nothing and exits with 0. When it fails, it prints one line for each error to standard error, then stops with policy lint failed (<n> error(s)) and exit code 2. Fix the reported fields and run the command again.
To start from a file that passes, run verdictan init. For permission policy documents, use --mode abac.
Examples
# Lint the default policy config, with mode detection
verdictan policy lint
# Lint a policy config in runtime mode
verdictan policy lint --mode runtime --file configs/production.yaml
# Lint a permission policy bundle
verdictan policy lint --mode abac --file iam-policies.yamlA minimal policy config that passes runtime lint:
pack:
name: "my-project"
version: "0.1.0"
enabled: true
policies:
chain:
- prompt-injectionA permission policy bundle that passes ABAC lint:
policies:
- name: Evidence Reader
statements:
- sid: ReadEvents
effect: allow
actions: ["events:read"]
resources: ["vdt:verdictan:events:eu:org_example:events"]The two-target example in verdictan gateway run also passes runtime lint.
Checks
Runtime mode checks a policy config in this order:
- The file has a
.yamlor.ymlextension, and it parses as YAML. - The document matches the declarative config schema. The schema rejects top-level keys that it does not define.
- Cross-field rules: for example, each
policies.chainentry is a known policy kind, eachpolicy.<kind>field is a key that the policy reads, removed fields are absent, and references between providers, routes, consumer groups, and tests resolve.
Runtime mode reports all errors together, in sorted order.
ABAC mode accepts one policy object, a list of policies, or a bundle with a policies array. It checks that:
- Each policy has a non-empty
nameand astatementsvalue. - Each statement document has at least one statement.
- Each statement uses only
sid,effect,actions,resources, andconditions, or their formsSid,Effect,Action,Resource, andCondition. effectisallowordeny, in any letter case.- Each action is
*, a known action, or<namespace>:*for a known namespace. - Each resource is
*or starts withvdt:verdictan:. - Condition operators and their values have the supported shape.
ABAC mode prefixes each error with the policy name, for example policy "Broken": statement 1 must use effect allow or deny.
Limits and failure behavior
| Condition | Result |
|---|---|
Runtime mode on a file without a .yaml or .yml extension | Error: policy config must be YAML (expected .yaml or .yml), exit 2. |
| The file does not exist | Error: failed to read <path>: ..., exit 2. |
--mode with another value | The argument parser rejects it with invalid value '<value>' for '--mode <MODE>', exit 2. |
An IAM document linted in runtime mode | The schema check fails. Use --mode abac or --mode auto. |
- When the document does not match the schema at the top level, runtime lint can report one long error. That error repeats the whole document as JSON and ends with
is not valid under any of the schemas listed in the 'oneOf' keyword. Check for unknown top-level keys and misspelled section names. - Lint checks the document only. It does not resolve provider credentials, run tests, or contact the control plane. Use
verdictan gateway checkandverdictan policy testfor those checks. - Lint and
verdictan config validateapply different rules. Both reject unknown fields and wrong types. Lint also rejects other schema findings that the loader can report as warnings. Use the checks appropriate to your configuration workflow. - A pass does not prove correct routing or fallback behavior. See Provider configuration before you enable more provider targets.
Complete command reference
Select a command for its complete input table. Default input means the value used when that option is omitted.
A value marked Not set can still come from configuration or the environment, as described above.
Set uppercase variables in example templates to your own resource IDs and paths before use.
See CLI scripting for quoting, output streams, confirmation, and exit codes.
verdictan policy lint [OPTIONS]| Input | Required | Default input | Meaning and accepted values |
|---|---|---|---|
--file <FILE> | No | policy-config.yaml | Policy config file to lint |
--mode <MODE> | No | auto | Lint mode: runtime, abac, or auto Values: auto, runtime, abac. |
--help (-h) prints help. The global --lang and --region options follow the shared input rules.
Result: Success has no result on standard output. Findings and hints use standard error. A failed lint returns exit 2.
Example template:
verdictan policy lintNext steps
- verdictan policy test: run behavior tests against the policy chain.
- verdictan config validate: check that the gateway loads the file, with JSON output for CI.
- Policy lifecycle: publish and roll out the config after lint.
- Manage configuration in a file: keep the config in version control.