pub struct Config {
pub scan: ScanConfig,
pub watch: WatchConfig,
pub text_files: TextFilesConfig,
pub ignore: IgnoreConfig,
pub baseline: BaselineConfig,
pub severity: SeverityConfig,
pub disabled_rules: HashSet<String>,
pub rules: Vec<YamlRule>,
pub malware_signatures: Vec<MalwareSignature>,
}Expand description
Main configuration structure for cc-audit
Fields§
§scan: ScanConfigScan configuration (CLI options)
watch: WatchConfigWatch mode configuration
text_files: TextFilesConfigText file detection configuration
ignore: IgnoreConfigIgnore configuration for scanning
baseline: BaselineConfigBaseline configuration for drift detection
severity: SeverityConfigRule severity configuration (v0.5.0)
disabled_rules: HashSet<String>Rule IDs to disable
rules: Vec<YamlRule>Custom rules defined in config file
malware_signatures: Vec<MalwareSignature>Custom malware signatures defined in config file
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_file(path: &Path) -> Result<Self, ConfigError>
pub fn from_file(path: &Path) -> Result<Self, ConfigError>
Load configuration from a file
Sourcepub fn load(project_root: Option<&Path>) -> Self
pub fn load(project_root: Option<&Path>) -> Self
Load configuration from the project directory or global config
Search order:
.cc-audit.yamlin project root.cc-audit.jsonin project root.cc-audit.tomlin project root~/.config/cc-audit/config.yaml- Default configuration
Sourcepub fn effective_disabled_rules(&self) -> HashSet<String>
pub fn effective_disabled_rules(&self) -> HashSet<String>
Get the effective set of disabled rules (merges severity.ignore and disabled_rules)
Sourcepub fn is_rule_disabled(&self, rule_id: &str) -> bool
pub fn is_rule_disabled(&self, rule_id: &str) -> bool
Check if a rule should be ignored based on both disabled_rules and severity.ignore
Sourcepub fn get_rule_severity(&self, rule_id: &str) -> Option<RuleSeverity>
pub fn get_rule_severity(&self, rule_id: &str) -> Option<RuleSeverity>
Get the RuleSeverity for a rule, considering both severity config and disabled_rules
Sourcepub fn generate_template() -> String
pub fn generate_template() -> String
Generate a YAML configuration template with comments
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more