nx_redact_lib.nx
buildroot/runtime/nx_redact_lib.nx
about
nx_redact_lib.nx -- REDACTION COMPLETENESS verifier for e-discovery production. Deterministic, byte-exact.
The content-level companion to nx_ediscovery (which is the ALLOW-LIST: only affirmatively-reviewed,
responsive documents may be produced). This is the other half: even a responsive document must have its
sensitive content redacted before it leaves the door. Where mainstream PII tools FLAG a hit for a human to
eyeball, this is FAIL-CLOSED -- a document is not producible while any detectable SSN or privilege marker
remains, full stop. Deterministic byte scanning, no LLM, no probability.
The SSN detector is PRECISE, not greedy: it matches ddd-dd-dddd only at a real number boundary, so it does
NOT false-fire on a wrong grouping (dd-dd-dddd) or on an SSN-shaped run embedded in a longer digit string
(over-blocking a clean doc is safe but annoying; the boundary checks keep it honest). Missing a real SSN
(a false NEGATIVE) is the dangerous case and is what the byte-exact pattern forecloses.
SCALE ENVELOPE (declared): substring is naive O(len*needle); KMP is the speed rung for large productions.
license_tier: ORIGINAL No hw writes (Rule 26). LIB.
dependencies 0 imports · 1 importers
imports: none
imported by: nx_redact_gate.nx
structs
| none |
consts
| 17 | const REDACT_NOT_FOUND: i64 = 0 - 1 |
functions
| 19 | func redact_len(s: *u8) -> i64 called by 1: main |
| 25 | func redact_is_digit(c: u8) -> i64 called by 1: redact_is_ssn_at |
| 32 | func redact_is_ssn_at(doc: *u8, i: i64, len: i64) -> i64 |
| 55 | func redact_find_ssn(doc: *u8, len: i64) -> i64 |
| 68 | func redact_count_ssn(doc: *u8, len: i64) -> i64 |
| 80 | func redact_contains(doc: *u8, len: i64, needle: *u8, nlen: i64) -> i64 |
| 101 | func redact_clean_for_production(doc: *u8, len: i64, marker: *u8, mlen: i64) -> i64 |
| 109 | func redact_production_ok(doc: *u8, len: i64, reviewed: i64, marker: *u8, mlen: i64) -> i64 |