Make the copied-secret ignore rules user-configurable #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/clip-5-configurable-ignore-rules"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
is_sensitiveinbreadclipd/src/ignore_rules.rswas a fixed set of five heuristics with no config surface. This adds an[ignore]section toconfig.toml:patterns: extra regular expressions. Copied text matching any of them is treated as sensitive and never persisted (host- or org-specific secret shapes the built-ins do not know about). An invalid pattern is logged to stderr and skipped, never fatal.disable: built-in rule names to switch off (private_key,credential_line,otp,card_number,api_token) for the case where a heuristic keeps tripping on something the user genuinely wants kept (an internal ID that is Luhn-valid, an OTP-shaped confirmation code, ...). An unknown name is logged and ignored.An absent
[ignore]section leaves the built-in heuristic exactly as before.Changes
breadclip-core/src/config.rs: newIgnoreConfig { patterns, disable }onConfig(drops theCopyderive, keepsClone); astring_arrayhelper reads a TOML string array, dropping a non-array value or non-string entries. Parsing stays on the same non-destructivetoml_editpath as the rest of the config.breadclipd/src/ignore_rules.rs:is_sensitiveis now a method on aRulesetcompiled fromIgnoreConfig(Ruleset::from_config).Ruleset::default()is byte-for-byte the old behaviour. Each built-in check is gated by its name sodisablecan turn it off;patternsare checked last. Newregexdependency inbreadclipd.breadclipd/src/main.rs: the two capture paths take&Ruleset, built once per capture event incapture_once(alongside the existing per-eventconfig::load()).README.md,contrib/config.toml.example, module docs: document the new section.Verification
cargo build --workspaceandcargo build --release --lockedcargo test --workspace --locked: 31 breadclipd + 19 breadclip-core tests pass, including new tests for parsing, extra-pattern matching, rule disabling, invalid-pattern skipping, and unknown-name handlingcargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo fmt --all --check: my changes are clean (two pre-existing unrelated drift spots inmain.rstests left untouched; breadclip CI does not gate fmt)Closes #5