kylerberry/prompt-spear
GitHub: kylerberry/prompt-spear
Stars: 0 | Forks: 0
# prompt-spear
\
--categories role-override,direct-injection \
--runs-per-probe 5 \
--min-score 90
### Audit a custom webhook endpoint
If your endpoint isn't OpenAI-compatible, supply a JSON body template with a `{{prompt}}` placeholder:
# payload.json
{ "message": "{{prompt}}", "sessionId": "my-session" }
npx prompt-spear \
--endpoint https://api.example.com/chat \
--request-template payload.json \
--key $YOUR_API_KEY
`{{prompt}}` is substituted with the attack text before each request. The response field is auto-detected from common names (`response`, `output`, `text`, `message`, `content`, etc.).
### JSON output for tooling
npx prompt-spear --demo hardened --output json
The JSON conforms to the `AuditReport` schema (overall `score`, `threshold`, `passed`, and per-category breakdown). A timestamped `_audit.json` file is also written after every run.
### Verbose progress and rate-limit tuning
npx prompt-spear \
--endpoint \
--key $KEY \
--verbose \
--concurrency 3 \
--max-retries 5
`--verbose` streams a result line to stderr as each probe completes and logs retry delays. `--concurrency` caps parallel probes; `--max-retries` controls 429 backoff attempts.
## Options
| Flag | Type | Default | Description |
|------|------|---------|-------------|
| `--endpoint ` | string | — | Target URL of an OpenAI-compatible `/chat/completions` endpoint. Required unless `--demo` is used. |
| `--key ` | string | `$ENDPOINT_API_KEY` | API key for the target, sent as a Bearer token. |
| `--header ` | string | — | Extra request header in `"Key: value"` form. Repeatable. |
| `--categories
- ` | string | all | Comma-separated attack categories: `direct-injection`, `role-override`, `system-prompt-extraction`, `encoding-obfuscation`. |
| `--runs-per-probe
标签:自动化攻击