Skip to content

Commit

Permalink
Expose the optional description field of rules
Browse files Browse the repository at this point in the history
  • Loading branch information
bradlarsen committed Dec 3, 2024
1 parent 369036f commit 45ee29c
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- `Credentials in .NET System.Net.NetworkCredential` ([#234](https://github.com/praetorian-inc/noseyparker/pull/234))
- `Kubernetes Bootstrap Token` ([#235](https://github.com/praetorian-inc/noseyparker/pull/235))

- Rules now contain an optional `description` string field.
This is intended to be a message for human consumption that indicates (a) what was detected and (b) how an attacker might use it.
Only a few rules have descriptions so far.
Use `rules list -f json` to see.


## [v0.21.0](https://github.com/praetorian-inc/noseyparker/releases/v0.21.0) (2024-11-20)

Expand Down
5 changes: 5 additions & 0 deletions crates/noseyparker-cli/src/cmd_rules/cmd_rules_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ fn check_rule(rule: &Rule, args: &RulesCheckArgs) -> Result<CheckStats> {
}
}

if args.pedantic && syntax.description.is_none() {
error!("Rule has no description");
num_errors += 1;
}

if num_warnings == 0 && num_errors == 0 {
info!("No issues detected");
} else {
Expand Down
Loading

0 comments on commit 45ee29c

Please sign in to comment.