okf-guard: A Security Layer for Open Knowledge Format (OKF) Pipelines
Catching Prompt Injection Before It Enters a Trusted Knowledge Base AI agents increasingly consume knowledge from sources they did not author and cannot independently verify: a PDF policy document, a scraped web page, a spreadsheet exported from another team's system. The prevailing approach — extract the text, write it into a knowledge base or context window, let the agent treat it as fact — has an underexamined weakness. Extraction tools capture everything present in a source document, including content a human reviewer would never see. The Mechanism Several ordinary, well-documented features of common file formats allow text to be present in a document while remaining invisible to anyone reading it normally: A PDF can render text in a rendering mode that instructs viewers not to display it, or set its fill color identical to the page background. A Word document has an explicit "hidden" attribute on any run of text, independent of color or size. A PowerPoint file's speaker notes are parsed by most extraction tools but never appear to an audience watching the presentation. A spreadsheet can mark entire rows, columns, or sheets as hidden, or attach a comment to a cell that is invisible unless hovered. An HTML page can hide an element from a browser's rendering entirely via a handful of standard CSS properties. None of these are obscure edge cases. They are common, legitimate formatting features, used constantly for entirely benign reasons — a hidden helper column in a spreadsheet, a private note to a presenter, draft text a Word user hid rather than deleted. The problem is not that these features exist; it is that an extraction pipeline has no reason to distinguish "this text is legitimate content" from "this text was deliberately hidden" unless something is specifically checking for the difference. Why This Matters for AI Pipelines Specifically If an attacker can place text anywhere in this chain — inside a PDF a company will later ingest, inside a web page a scrap