Skip to contents

list_rules() returns a compact inventory of a policy's rule set. It is intended for audits, examples, tests, and pre-deployment reviews.

Usage

list_rules(policy, show_stats = FALSE)

Arguments

policy

A shieldr_policy or built-in policy name such as "comprehensive".

show_stats

Show listing time and available usage metrics.

Value

A data frame with columns id, owasp, severity, action, has_pattern, has_fn, and redaction_span_guaranteed.

Details

The has_pattern and has_fn columns identify whether each rule is regex based or function based. redaction_span_guaranteed is TRUE for non-redaction rules and regex redaction rules. It is FALSE for function redaction rules because their output cannot be proven to contain spans by inspecting the rule object; runtime scanning still validates actual spans.

Examples

list_rules(policy("custom"))
#> [1] id                        owasp                    
#> [3] severity                  action                   
#> [5] has_pattern               has_fn                   
#> [7] redaction_span_guaranteed
#> <0 rows> (or 0-length row.names)