code wiki / (root) / nx_redact_lib.nx

nx_redact_lib.nx

buildroot/runtime/nx_redact_lib.nx

4497 B112 linesdepth 0pulls 0 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_redact_lib.nx nx_redact_gate.nx

imports: none

imported by: nx_redact_gate.nx

structs

none

consts

17const REDACT_NOT_FOUND: i64 = 0 - 1

functions

19func redact_len(s: *u8) -> i64
called by 1: main
25func redact_is_digit(c: u8) -> i64
called by 1: redact_is_ssn_at
32func redact_is_ssn_at(doc: *u8, i: i64, len: i64) -> i64
55func redact_find_ssn(doc: *u8, len: i64) -> i64
68func redact_count_ssn(doc: *u8, len: i64) -> i64
called by 1: main calls 1: redact_is_ssn_at
80func redact_contains(doc: *u8, len: i64, needle: *u8, nlen: i64) -> i64
101func redact_clean_for_production(doc: *u8, len: i64, marker: *u8, mlen: i64) -> i64
109func redact_production_ok(doc: *u8, len: i64, reviewed: i64, marker: *u8, mlen: i64) -> i64
called by 1: main calls 1: redact_clean_for_production