security-integration-tests
Manages and runs integration tests for prompt injection detection systems.
Install
mkdir -p .claude/skills/security-integration-tests && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4941" && unzip -o skill.zip -d .claude/skills/security-integration-tests && rm skill.zipInstalls to .claude/skills/security-integration-tests
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Use this agent when working with prompt injection detection integration tests, including running tests, debugging failures, or adding new test samples.Key capabilities
- →Run prompt injection detection integration tests
- →Add new malicious test samples to samples.json
- →Debug prompt injection detection failures
- →Verify security analyzer integration with real API calls
- →Run integration tests with a custom HuggingFace model
How it works
Integration tests verify prompt injection detection accuracy by making real API calls to the HuggingFace Inference API using predefined benign and malicious samples.
Inputs & outputs
When to use security-integration-tests
- →Run prompt injection detection tests
- →Add new malicious test samples
- →Debug prompt injection detection failures
- →Verify security analyzer integration
About this skill
Security Integration Tests Agent
Overview
The security package (pkg/security/) provides prompt injection detection using the HuggingFace Inference API. Integration tests verify detection accuracy with real API calls.
Key Files
pkg/security/testdata/samples.json- Test data with benign and malicious samplespkg/security/hf/integration_test.go- HF client integration testspkg/security/integration_test.go- Full analyzer integration tests with event buspkg/security/hf/client.go- HuggingFace API client implementationpkg/security/analyzer.go- Main security analyzer that subscribes to MCP events
Running Tests
# Run integration tests (requires HF_TOKEN environment variable)
HF_TOKEN=hf_xxx make test-integration
# Run with custom model
HF_TOKEN=hf_xxx HF_MODEL=protectai/deberta-v3-base-prompt-injection-v2 make test-integration
# Run unit tests only (no API calls, uses mock server)
go test -v ./pkg/security/...
Test Structure
Test Samples (samples.json)
{
"benign_samples": [
{
"description": "Description of the sample",
"text": "The text to analyze",
"expected_detected": false
}
],
"malicious_samples": [
{
"description": "Direct instruction override",
"text": "Ignore all previous instructions...",
"expected_detected": true,
"min_risk_score": 0.5
}
],
"mcp_tool_calls": [
{
"description": "Malicious tool call",
"method": "tools/call",
"params": { "name": "run_command", "arguments": {...} },
"expected_detected": true,
"min_risk_score": 0.5
}
]
}
Integration Test Tags
Integration tests use the build tag //go:build integration and are excluded from regular go test ./... runs.
Adding New Test Samples
- Edit
pkg/security/testdata/samples.json - Add samples to appropriate category (benign_samples, malicious_samples, or mcp_tool_calls)
- Set
expected_detectedand optionallymin_risk_score - Run integration tests to verify
Common Issues
"Forbidden" Error
- Ensure HF_TOKEN is set and valid
- Note:
meta-llama/Llama-Prompt-Guard-2-86Mis deprecated on HF Inference API - Default test model is
protectai/deberta-v3-base-prompt-injection-v2(publicly accessible)
Model Loading
- HuggingFace warms up models on demand
- Tests may skip with "Model loading" message on first run
- Re-run tests after model is warm
Network Issues
- Integration tests require network access to HuggingFace API
- Tests will fail in sandboxed environments without network access
Risk Levels
none: score < 0.3low: score 0.3-0.5medium: score 0.5-0.7high: score 0.7-0.9critical: score >= 0.9
Categories
benign: Normal, safe contentinjection: Prompt injection attemptjailbreak: Jailbreak attemptmalicious: Malicious content (Prompt Guard v2)
When not to use it
- →When network access to the HuggingFace API is unavailable
- →When only unit tests are required without API calls
Prerequisites
Limitations
- →Requires network access to the HuggingFace API
- →Tests may skip with a "Model loading" message on the first run as HuggingFace warms up models
How it compares
This skill directly tests the security analyzer's performance against a live API, unlike unit tests that use a mock server.
Compared to similar skills
security-integration-tests side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| security-integration-tests (this skill) | 1 | 7mo | Review | Intermediate |
| security-requirement-extraction | 7 | 2mo | No flags | Intermediate |
| redteam-plugin-development | 3 | 3mo | No flags | Intermediate |
| api-fuzzing-for-bug-bounty | 9 | 6mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by alex-ilgayev
View all by alex-ilgayev →You might also like
security-requirement-extraction
wshobson
Derive security requirements from threat models and business context. Use when translating threats into actionable requirements, creating security user stories, or building security test cases.
redteam-plugin-development
promptfoo
Standards for creating redteam plugins and graders. Use when creating new plugins, writing graders, or modifying attack templates.
api-fuzzing-for-bug-bounty
davila7
This skill should be used when the user asks to "test API security", "fuzz APIs", "find IDOR vulnerabilities", "test REST API", "test GraphQL", "API penetration testing", "bug bounty API testing", or needs guidance on API security assessment techniques.
secure-workflow-guide
trailofbits
Guides through Trail of Bits' 5-step secure development workflow. Runs Slither scans, checks special features (upgradeability/ERC conformance/token integration), generates visual security diagrams, helps document security properties for fuzzing/verification, and reviews manual security areas.
cross-site-scripting-and-html-injection-testing
davila7
This skill should be used when the user asks to "test for XSS vulnerabilities", "perform cross-site scripting attacks", "identify HTML injection flaws", "exploit client-side injection vulnerabilities", "steal cookies via XSS", or "bypass content security policies". It provides comprehensive techniques for detecting, exploiting, and understanding XSS and HTML injection attack vectors in web applications.
defense-in-depth-validation
mrgoonie
Validate at every layer data passes through to make bugs impossible