AI and prompt injections: the invoice that approves itself.
Demonstrates indirect prompt injection against an external AI invoice extraction pipeline (.NET with Azure OpenAI) that creates payment records in Business Central: hidden white text in a PDF swaps the IBAN and marks the invoice as approved. Presents a five-layer defense: hidden text detection, sending rendered page images to the model, strict schemas, no approval field, and deterministic IBAN checks against vendor master data.

post Stefano Demiliani
"Your AI will believe anything a document tells it. Build a system that doesn't."
Key points
- Indirect prompt injection occurs when untrusted documents contain hidden instructions that manipulate AI model behavior, posing risk to invoice processing and payment automation
- PDFs are effective attack vectors because text extractors capture invisible content (white text, tiny fonts, hidden metadata) that humans cannot see
- A vulnerable pipeline allows the AI model to extract data, make approval decisions, and directly influence business transactions without validation
- Defense requires five layered controls: hidden text detection, rendering pages as images for vision models, strict output schemas, removing decision fields, and deterministic validation against master data
- The architecture and design determine security more than the prompt; payment decisions must come from internal workflow and verified data, never from document content
Quotes
- “Your AI will believe anything a document tells it. Build a system that doesn’t.” (Core principle: security must be in the system design and architecture, not relying on AI behavior or prompts alone)
- “Prompt injection isn’t a bug you patch in the prompt. It’s a trust problem you solve in the design.” (Reframes the security challenge as an architectural issue requiring deterministic controls, not just better instructions)
Heads up
- warning: “Prompt injection happens when text supplied by someone other than the developer changes what the model does.”
- warning: “Indirect injection is the dangerous one for business applications, because the attacker only needs to get a document into your workflow.”
- warning: “Never ask the model for a decision the document could influence.”
Context
- Features: Invoice extraction with AI, Document intake automation, Prompt injection detection, Hidden text analysis, Vision model-based document processing, Structured outputs with strict schemas, Master data validation, Payment approval workflow
Source: Stefano Demiliani, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.