1
0
Fork 0
llm-ingestion-pipeline-secu.../tests
Kjell Tore Guttormsen 2d98d6809d feat(sanitize,fence,neutralize): reject oversize input instead of half-transforming it
The scanners cap by truncating: they return findings, so reading a prefix costs
detection in the tail and nothing else. The three transform surfaces return
*content*, where the same move is not available — a shortened document is silent
data loss, and a transformed prefix followed by an untransformed tail is a
bypass, since the attacker chooses where in the document the payload sits.

So they fail secure instead. Above MAX_INPUT_CHARS (1 000 000) sanitize, fence
and neutralize raise OversizeInputError. sanitize is step 1 of prepare_input and
only ever removes, so that one refusal bounds the whole input path.

OversizeInputError subclasses ContractViolation: a pipeline already bracketing
its quarantined stage keeps failing closed rather than meeting a type it has
never heard of. It inherits the alert-routable property too — sizes in the
message, refusing surface in details, no input in either.

Invariant now pinned across all three: returned text is always fully
transformed, or not returned at all.

Still uncapped and recorded in LIMITATIONS: scan_active_content called directly
(through scan_output it inherits that cap) and the okf link graph. Both are
detection-shaped, so truncate-and-flag transfers unchanged — mechanical, not
policy.

699 tests (+23), coverage 128/128 + 6/6, ReDoS sweep 0 candidates / 150.
2026-08-02 21:13:08 +02:00
..
inbox_frontend.py feat(okf): scan reserved index.md/log.md in mode-b import, not path-reject (review MAJOR #2) 2026-07-15 06:43:50 +02:00
test_active_content.py fix(sanitize,okf,active_content): three quadratic patterns, two on the input path 2026-08-01 20:06:36 +02:00
test_calibration.py fix(output): 19 quadratic regex runs on the output path, worst ~5.7h at the cap 2026-07-31 18:31:58 +02:00
test_contract.py fix(security): harden 5 adversarial-review findings (M1/M2/M3 + m4/m6) via TDD 2026-07-05 10:45:05 +02:00
test_corpus.py fix(calibration): grade active content on URL shape, not construct type 2026-07-25 15:36:02 +02:00
test_coverage_matrix.py test(coverage): runnable threat-coverage matrix (real-case validation gate) 2026-07-15 11:20:22 +02:00
test_disposition.py fix(calibration): grade active content on URL shape, not construct type 2026-07-25 15:36:02 +02:00
test_entropy.py fix(security): harden 5 adversarial-review findings (M1/M2/M3 + m4/m6) via TDD 2026-07-05 10:45:05 +02:00
test_fence.py feat(fence): randomized unspoofable delimiter + attacker marker-strip (TDD) [skip-docs] 2026-07-04 18:23:35 +02:00
test_grounding.py feat(grounding): SourceGroundingCheck protocol + pass-through default — the semantic-poisoning seam (TDD) [skip-docs] 2026-07-04 22:44:41 +02:00
test_input_cap.py feat(sanitize,fence,neutralize): reject oversize input instead of half-transforming it 2026-08-02 21:13:08 +02:00
test_lexicon.py fix(lexicon): two quadratic patterns, reachable through the output gate too 2026-07-31 21:50:51 +02:00
test_neutralize.py fix(sanitize,okf,active_content): three quadratic patterns, two on the input path 2026-08-01 20:06:36 +02:00
test_okf.py fix(sanitize,okf,active_content): three quadratic patterns, two on the input path 2026-08-01 20:06:36 +02:00
test_okf_inbox_uploads.py feat(inbox): .xlsx extraction — formula gate, hidden sheets, cell comments (stage 2h) 2026-07-07 07:41:00 +02:00
test_okf_showcase.py feat(okf): scan reserved index.md/log.md in mode-b import, not path-reject (review MAJOR #2) 2026-07-15 06:43:50 +02:00
test_output.py fix(sanitize,okf,active_content): three quadratic patterns, two on the input path 2026-08-01 20:06:36 +02:00
test_report.py feat: scaffold package + report and sanitize modules (TDD) 2026-07-04 09:24:20 +02:00
test_sanitize.py fix(sanitize,okf,active_content): three quadratic patterns, two on the input path 2026-08-01 20:06:36 +02:00
test_showcase.py feat(guard): active-content detector wired into the output gate (review MAJOR #1) 2026-07-15 06:11:33 +02:00
test_url_shape_doc.py docs(url-shape): make the rule reconstructable, and record what three corpora measured 2026-07-27 08:56:24 +02:00
test_wiring.py docs(limitations): bound two URL-shape false positives with field measurements 2026-07-25 20:56:14 +02:00