docs/generated/contracts.mdgenerated from code
Reference · 2 min read
secrets
Contracts: secrets.
Read as
Source: crates/lvcs/src/secrets/mod.rs.
1/// What the secret scan found (discussion:owner/513): code points `start..end` of2/// the scanned text and the `rule` that flagged them (a known token3/// format's name, or `entropy` for the high-entropy heuristic). The daemon4/// answers with it as `SecretData`. Owner: `M3.secrets`.5#[derive(Debug, Clone, PartialEq, Eq)]6pub(crate) struct SecretHit {7 pub(crate) start: usize,8 pub(crate) end: usize,9 pub(crate) rule: String,10}1112/// `lvcs.toml` `[secrets]` (discussion:owner/37), part of the daemon's `LvcsToml`:13/// `exempt` lists paths the scan skips (`tests/fixtures/**`), and14/// `never_sync` paths never read into documents beyond `DEFAULT_NEVER_SYNC`15/// and `.gitignore`, both gitignore syntax relative to the tree's root. A16/// missing key is empty. Owner: `M3.secrets`.17#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]18#[serde(default)]19pub(crate) struct SecretsConfig {20 /// The paths the secret scan skips, in gitignore syntax.21 pub(crate) exempt: Vec<String>,22 /// The paths never read into documents, in gitignore syntax.23 pub(crate) never_sync: Vec<String>,24}2526/// The scanner the daemon runs on a request's resulting text before it is27/// committed: `config` from `lvcs.toml`, and `allowed`, the hashes of the28/// strings peers forced with `lvcs add --force` (the signed allowlist,29/// which is project data, not `lvcs.toml`). Owner: `M3.secrets`.30#[derive(Debug, Clone, Default)]31pub(crate) struct Scanner {32 config: SecretsConfig,33 /// `config`'s `exempt` lines as one matcher, built with the scanner34 /// and shared by its copies, never per scan (`None`: no line, or a set35 /// that fails to build, which scans every path).36 exempt: Arc<Option<Gitignore>>,37 allowed: BTreeSet<[u8; 32]>,38}