← All questions
Security & SafetyHard· System Design· Latency· Injection Attacks

Security requires scanning and stripping instructions f...

Instead of debating the 180ms in the abstract, measure the actual security benefit against a red-team set. You can optimize by applying the scan only to lower-trust sources like user uploads rather than curated internal data. Finally, consider moving the scan to ingestion time, which processes documents before they are indexed, thereby removing the latency penalty from the query path entirely.

Code playground (Python)