AuditConfig class

Settings from security_audit.yaml at the project root.

rules:
  SD002: false        # disable a rule
fail_on: high         # exit 1 only for findings at/above this severity
baseline: security_baseline.json  # known findings to suppress
exclude:
  - lib/generated/**  # glob, relative to the project root

Unknown keys are an error: a typo that silently disables a setting is worse than a failed run.

Constructors

AuditConfig({Set<String> disabledRules = const {}, Severity failOn = Severity.low, String? baselinePath, List<String> exclude = const []})
AuditConfig.load(Directory root)
Reads security_audit.yaml from root if present; defaults otherwise. Throws FormatException on malformed config.
factory
AuditConfig.parse(String source)
factory

Properties

baselinePath String?
Baseline file path relative to the project root. When null, the default security_baseline.json is used if it exists.
final
disabledRules Set<String>
Rule ids switched off via rules: {SD###: false}.
final
excludePatterns List<String>
The raw exclude globs, as written in the config.
final
failOn Severity
Findings at or above this severity make the run exit 1. Everything is still reported; this only gates the exit code.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({Severity? failOn}) AuditConfig
excludes(String path) bool
Whether a root-relative path (forward slashes) is excluded from the scan.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
ruleEnabled(String id) bool
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited