How mizcausevic-dev/prompt-injection-bench-web works
Purpose and principal workflow
A human evaluator uses the browser-based harness to inspect the bundled prompt-injection attack corpus and score an agent’s JSONL transcript. The app parses the pasted transcript, scores responses against attacks, and renders category/severity results and critical failures locally; the README explicitly states that transcripts are not sent to a server.
Components
Browser application
• Human evaluator — repository path: null. Supplies or loads a transcript, explores the corpus, and initiates scoring.
• React bootstrap — src/main.tsx. Mounts the React app into the page root and loads its styles.
• Benchmark interface — src/App.tsx. Presents corpus browsing, transcript input, scoring controls, and the resulting report; its run handler calls the transcript parser and runner and stores parse errors and results in UI state.
Benchmark data and scoring
• Attack corpus — src/bench/corpus.ts. Bundles the attack records used by the app; the README describes 30 records, with categories, severity, expected behavior, and Agent Card refusal-taxonomy references.
• Benchmark types — src/bench/types.ts. Defines the TypeScript benchmark data model; the README describes it as a port of the Python harness’s schema.
• Transcript runner — src/bench/runner.ts. Exposes transcript parsing and scoring orchestration, including aggregation, as reflected in the functions called by the interface and the README.
• Response scorer — src/bench/scorer.ts. Implements the README-documented keyword-based scoring methods used to evaluate agent responses.
• Sample transcripts — src/bench/samples.ts. Provides sample transcripts that the README says can be loaded with a click.
Relationships
• Human evaluator -> Benchmark interface: enters or selects a transcript and requests scoring; the interface exposes transcript input and a “Score transcript” action.
• React bootstrap -> Benchmark interface: mounts the application component in the page root.
• Benchmark interface -> Attack corpus: reads bundled records to display corpus categories, counts, and attack details.
• Benchmark interface -> Sample transcripts: makes sample transcripts available for the documented click-to-load flow.
• Benchmark interface -> Transcript runner: calls parsing and scoring when the evaluator runs a non-empty transcript.
• Transcript runner -> Response scorer: intended scoring relationship, supported by the README’s description of the runner and scorer roles; the sampled runner implementation does not establish the exact call wiring.
• Transcript runner -> Benchmark interface: returns a result that the interface stores and renders; parse errors are also exposed in the interface.
• Attack corpus -> Benchmark interface: supplies records for the UI’s category and severity summaries and corpus browser.
Coverage limits
The runner, scorer, corpus, types, and samples are not shown in source excerpts, so their internal algorithms, exact data shapes, and call wiring cannot be confirmed here. Deployment is documented, but the sampled inputs do not establish the deployed runtime beyond the stated client-side behavior.
Main entry points: App.tsx Benchmark interface · runner.ts Transcript runner · corpus.ts Attack corpus · main.tsx React bootstrap
Components 7
Browser application
- React bootstrap
src/main.tsx - Benchmark interface
src/App.tsx
Benchmark data and scoring
- Attack corpus
src/bench/corpus.ts - Transcript runner
src/bench/runner.ts - Response scorer
src/bench/scorer.ts - Sample transcripts
src/bench/samples.ts
Other components
- Human evaluator
Connections 8
- Human evaluator → Benchmark interface: enters and scores
- React bootstrap → Benchmark interface: mounts
- Benchmark interface → Attack corpus: reads
- Benchmark interface → Sample transcripts: loads samples
- Benchmark interface → Transcript runner: runs transcript
- Transcript runner → Response scorer: scores responses · Intended relationship; exact call wiring is not confirmed.
- Transcript runner → Benchmark interface: returns results
- Attack corpus → Benchmark interface: supplies records