1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! Ingest: walk a project, drop secrets and junk, window files into chunks.
//!
//! The walk honours `.gitignore`, `.ignore`, `.git/info/exclude` and a project-local
//! `.pithignore` (never the global gitignore, never parent directories). Dot-files and
//! dot-directories are walked on purpose so the secrets deny list, not the walker's
//! hidden-file filter, decides what is excluded; `.git` itself is never entered.
//!
//! Limits, stated plainly.
//!
//! - The PEM content check is header-only: raw base64 or DER keys without a header are
//! not detected by content (DER is binary and skipped as such).
//! - Deny rules are path-based, so an in-tree hardlink to a secret under another name is
//! not detected by name; the PEM content check is the backstop for key material.
//! - `.ssh`, `.gnupg`, `.aws` and `.kube` directory names are denied wholesale everywhere
//! in the tree, so a legitimate source directory with one of those names is not indexed.
//! - After each open the file's real path is resolved from the handle (`F_GETPATH` on
//! macOS, `/proc/self/fd` elsewhere). On unix systems with neither (the BSDs by default,
//! such as FreeBSD, OpenBSD and NetBSD, and some minimal containers without `/proc`)
//! every file is skipped as `Unreadable` and indexing produces nothing. Failing closed
//! is deliberate.
//! - Names are not Unicode-normalized beyond lowercasing. Characters that lowercase to
//! ASCII, such as KELVIN SIGN (U+212A, which becomes `k`), are folded and so fail
//! closed; homoglyphs from other scripts are different file names from the real secret
//! names and are not normalized.
//! - On non-unix targets (best effort) files are opened without `O_NOFOLLOW`, without a
//! file-identity check and without the resolved-path check; only the walk-time symlink
//! skip applies, so the race guarantee documented on [`collect`] is weaker there.
pub use is_denied;
pub use ;
/// One window of a source file.
/// Why a file produced no chunks.
/// Result of [`collect`]: chunks sorted by path then start line, plus every skipped file.