SE

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.zip

Installs 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.
151 chars✓ has a “when” trigger
Intermediate

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

You give it
Test samples in samples.json, HF_TOKEN, and optional HF_MODEL
You get back
Test results indicating detection accuracy or failures

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 samples
  • pkg/security/hf/integration_test.go - HF client integration tests
  • pkg/security/integration_test.go - Full analyzer integration tests with event bus
  • pkg/security/hf/client.go - HuggingFace API client implementation
  • pkg/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

  1. Edit pkg/security/testdata/samples.json
  2. Add samples to appropriate category (benign_samples, malicious_samples, or mcp_tool_calls)
  3. Set expected_detected and optionally min_risk_score
  4. Run integration tests to verify

Common Issues

"Forbidden" Error

  • Ensure HF_TOKEN is set and valid
  • Note: meta-llama/Llama-Prompt-Guard-2-86M is 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.3
  • low: score 0.3-0.5
  • medium: score 0.5-0.7
  • high: score 0.7-0.9
  • critical: score >= 0.9

Categories

  • benign: Normal, safe content
  • injection: Prompt injection attempt
  • jailbreak: Jailbreak attempt
  • malicious: 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

HF_TOKEN environment variable

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.

SkillInstallsUpdatedSafetyDifficulty
security-integration-tests (this skill)17moReviewIntermediate
security-requirement-extraction72moNo flagsIntermediate
redteam-plugin-development33moNo flagsIntermediate
api-fuzzing-for-bug-bounty96moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

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.

759

redteam-plugin-development

promptfoo

Standards for creating redteam plugins and graders. Use when creating new plugins, writing graders, or modifying attack templates.

338

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.

929

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.

331

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.

322

defense-in-depth-validation

mrgoonie

Validate at every layer data passes through to make bugs impossible

319

Search skills

Search the agent skills registry