redact_scan/lib.rs
1// Copyright 2026 Censgate LLC.
2// Licensed under the Apache License, Version 2.0. See the LICENSE file
3// in the project root for license information.
4
5//! Read-only Postgres PII discovery scanner.
6//!
7//! Prefer a replica or staging database. Reports list locations and counts
8//! only — never sample values.
9
10/// Rule-of-three helper for negative samples.
11pub mod bound;
12/// Canonical JSON hashing for [`ScanReport::content_hash`].
13pub mod canonical;
14/// Layer 0 catalog metadata.
15pub mod catalog;
16/// Command-line argument types.
17pub mod cli;
18/// Pattern-engine wrapper that drops matched text.
19pub mod detect;
20/// Scrubbed scanner errors.
21pub mod error;
22/// Human-readable table output.
23pub mod format;
24/// Identifier quoting.
25pub mod ident;
26/// Layer 2 JSON path sampling.
27pub mod json_scan;
28/// Discovery layer identifiers (`0`, `0.5`, `1`, `2`).
29pub mod layers;
30/// Value-free report types.
31pub mod report;
32/// Read-only session and privilege checks.
33pub mod safety;
34/// Layer 1 table sampling.
35pub mod sample;
36/// Scan orchestration.
37pub mod scan;
38/// Name and type heuristics.
39pub mod score;
40/// Credential redaction for logs and errors.
41pub mod scrub;
42/// Layer 0.5 planner statistics.
43pub mod stats;
44/// Optional HTTP POST of the report JSON.
45pub mod upload;
46
47pub use error::ScanError;
48pub use report::{Finding, ScanReport};
49pub use scan::run_scan;
50
51/// Process exit code when the scan completed with no fail-on match.
52pub const EXIT_CLEAN: i32 = 0;
53/// Process exit code when `--fail-on` matched at least one finding.
54pub const EXIT_FINDINGS: i32 = 1;
55/// Process exit code for usage errors, safety refusals, and I/O failures.
56pub const EXIT_ERROR: i32 = 2;