How saksham6349/prompt-injection-benchmark works
This repository benchmarks indirect prompt injection against tool-using LLM agents and provides a three-layer defense. The principal flow is a user task through the agent/provider loop, sandbox tool execution, policy checks before actions, and provenance/classifier processing of retrieved output before it returns to the model. Evaluation, attack taxonomy, and baseline defenses are separate product capabilities. Some subsystem relationships are documented in the README; unsampled modules are included only where the README or source index supports them.
Main entry points: executor.py Tool Executor · harness.py Agent Harness · state.py SQLite Sandbox State · runner.py Evaluation Runner
Components 22
Agent Runtime
- Agent Harness
src/agent/harness.py - Prompt Builder
src/agent/prompts.py - LLM Providers
src/agent/providers - Response Cache
src/agent/cache.py
Defense Pipeline
- Defense Orchestrator
src/defense/pipeline.py - Provenance Tagger
src/defense/provenance.py - Injection Classifier
src/defense/classifier.py - Tool Policy
src/defense/policy.py
Mock Sandbox
- Tool Executor
src/sandbox/executor.py - SQLite Sandbox State
src/sandbox/state.py - Email Tools
src/sandbox/tools/email.py - Calendar Tools
src/sandbox/tools/calendar.py - Bank Tools
src/sandbox/tools/bank.py - File Tools
src/sandbox/tools/filestore.py - Web Fetch
src/sandbox/tools/web_fetch.py
Benchmark Evaluation
- Evaluation Runner
src/evaluation/runner.py - Metrics
src/evaluation/metrics.py - Report Generation
src/evaluation/report.py
Attack Research
- Attack Taxonomy
src/taxonomy/taxonomy.py - Defense Baselines
src/baselines - CLI Scanner
scripts/scan.py
Other components
- User
Connections 28
- User → Agent Harness: submits task
README.md - Agent Harness → Prompt Builder: builds prompt
src/agent/harness.py - Agent Harness → LLM Providers: requests completion
src/agent/harness.py - Agent Harness → Response Cache: reads and writes
src/agent/harness.py - Agent Harness → Tool Executor: executes calls
README.md - Agent Harness → Defense Orchestrator: checks tool activity
README.md - Defense Orchestrator → Tool Policy: checks proposed calls
src/defense/pipeline.py - Defense Orchestrator → Provenance Tagger: tags tool output
src/defense/pipeline.py - Defense Orchestrator → Injection Classifier: scores tool output
src/defense/pipeline.py - Tool Executor → SQLite Sandbox State: logs tool calls
src/sandbox/executor.py - Tool Executor → Email Tools: dispatches
src/sandbox/executor.py - Tool Executor → Calendar Tools: dispatches
src/sandbox/executor.py - Tool Executor → Bank Tools: dispatches
src/sandbox/executor.py - Tool Executor → File Tools: dispatches
src/sandbox/executor.py - Tool Executor → Web Fetch: dispatches
src/sandbox/executor.py - Email Tools → SQLite Sandbox State: reads and writes
src/sandbox/tools/email.py - Calendar Tools → SQLite Sandbox State: reads and writes
src/sandbox/tools/calendar.py - Bank Tools → SQLite Sandbox State: reads and writes
src/sandbox/tools/bank.py - File Tools → SQLite Sandbox State: reads and writes
src/sandbox/tools/filestore.py - Web Fetch → SQLite Sandbox State: reads sandbox pages
src/sandbox/tools/web_fetch.py - Evaluation Runner → Agent Harness: runs cases through
src/evaluation/runner.py - Evaluation Runner → Tool Executor: configures tools
src/evaluation/runner.py - Evaluation Runner → SQLite Sandbox State: captures outcomes
src/evaluation/runner.py - Evaluation Runner → Metrics: evaluates results
- Report Generation → Metrics: formats metrics
src/evaluation/report.py - Attack Taxonomy → Evaluation Runner: defines attack space
- Defense Baselines → Evaluation Runner: compared in benchmark
README.md - CLI Scanner → Defense Orchestrator: scans input