Skip to content

Reference

Policy schema

Every key a policy document accepts, with its default and its constraint.

Unknown keys are rejected at every level. A typo should stop the process rather than silently disable a check.

Document

KeyTypeRequiredConstraint
policy_idstryes^[a-z0-9][a-z0-9._-]{0,63}$
versionintyesat least 1
descriptionstrnodefaults to empty
fail_modestr or mappingyesopen or closed, per tier or for all
detectorsmappingyesdetector id to settings

Detector

KeyTypeDefaultConstraint
enabledbooltrueT0 cannot be disabled
on_failstrflagone of block, redact, rewrite, flag, log
thresholdfloat0.50.0 to 1.0 inclusive
alwaysboolfalseT3 only
optionsmapping{}detector specific

Errors

load_policy raises PolicyError for anything wrong with the document, including an unknown detector id. DetectorUnavailableError is a subclass of it, raised when a policy expects a detector this install does not have in order to enforce something.

Both are raised rather than warned. Scanning under a policy the caller did not write is worse than refusing to start.

This page is generated from docs/reference/policy-schema.md in the library repository. Read it as markdown, or edit it at the source.