Testing whether XML tags provide better protection against prompt injection attacks compared to Markdown delimiters.
- Set your OpenAI API key:
export OPENAI_API_KEY=your-api-key-here- Run the tests:
cd PromptInjectionTest.Tests
dotnet run24 prompt injection attacks tested across multiple models. Each attack tested with:
- Markdown delimiters (
##) vs XML tags (<tags>) - User prompt injection vs System prompt injection
| Strategy | Average Success Rate |
|---|---|
| Markdown-System | 84.2% |
| XML-System | 83.3% |
| Markdown-User | 83.3% |
| XML-User | 82.5% |
Key Finding: Delimiter format (XML vs Markdown) makes minimal difference (1.7% variance). Model capability matters far more than delimiter choice.