viper-ai-llm-guardrails
Skill22 starsChanged 16 days agoMITView on GitHub
AI, LLM & MCP Application Security & Guardrails Auditor (OWASP LLM Top 10). Reviews prompt boundaries, RAG data isolation, tool-call authorization, and output sanitization.
In this repository72 other files it gives its agents.
- llms.txtllms.txt
- viper-agent-skill-supplychainSkill
- viper-api-gateway-apigee-kongSkill
- viper-auth-oauth-jwtSkill
- viper-aws-iam-cloud-auditSkill
- viper-bola-idorSkill
- viper-browser-extension-mv3Skill
- viper-browseros-agentSkill
- viper-cicd-hardeningSkill
- viperclawSkill
- viper-container-k8s-auditSkill
- viper-crypto-tls-auditSkill
- viper-csrf-samesite-auditSkill
- viper-dependency-sbomSkill
- viper-deserialization-parserSkill
- viper-diff-pr-reviewSkill
- viper-dns-email-domainSkill
- viper-electron-tauri-desktopSkill
- viper-fastapi-django-flaskSkill
- viper-file-upload-storageSkill
- viper-gcp-azure-cloud-auditSkill
- viper-github-repo-governanceSkill
- viper-go-service-auditSkill
- viper-graphql-wsSkill
- viper-grpc-protobuf-auditSkill
- viper-headers-csp-corsSkill
- viper-iac-terraform-auditSkill
- viper-incident-forensics-triageSkill
- viper-injection-oracleSkill
- viper-java-spring-auditSkill
- viper-js-harvesterSkill
- viper-kafka-rabbitmq-queueSkill
- viper-linux-systemd-hostSkill
- viper-logging-pii-complianceSkill
- viper-mcp-server-auditSkill
- viper-mobile-api-configSkill
- viper-multitenant-isolationSkill
- viper-nextjs-react-rscSkill
- viper-nginx-envoy-gatewaySkill
- viper-nodejs-express-nestjsSkill
- viper-oauth-oidc-complianceSkill
- viper-openapi-rest-schemaSkill
- viper-orchestratorSkill
- viper-payment-stripe-pciSkill
- viper-php-laravel-wordpressSkill
- viper-postgres-redis-mongoSkill
- viper-privacy-gdpr-hipaaSkill
- viper-proof-judgeSkill
- viper-proxy-fingerprintSkill
- viper-proxy-parser-alignmentSkill
- viper-race-logicSkill
- viper-rag-vector-auditSkill
- viper-rate-limit-dos-resilienceSkill
- viper-remediation-patch-verifierSkill
- viper-ruby-rails-auditSkill
- viper-rust-memory-unsafeSkill
- viper-saml-sso-enterpriseSkill
- viper-sbom-slsa-provenanceSkill
- viper-secrets-auditSkill
- viper-semgrep-rule-authorSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 30
Run the following discovery commands across the target repository before manual code review:
- Distinctive: line 62
Verify whether an upstream API Gateway, global middleware, or ORM hook already enforces the control before flagging a controller.
- Distinctive: line 93
Write a Positive Unit Test confirming authorized, schema-valid requests succeed.
- Distinctive: line 94
Write a Negative Security Regression Test confirming unauthorized, cross-tenant, or malformed inputs are deterministically rejected.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AI, LLM & Agentic Application Guardrails Auditor (OWASP LLM Top 10) (viper-ai-llm-guardrails)
1. Executive Scope, Standards & CWE/OWASP Mapping
- Frameworks & Standards: OWASP Top 10 for LLM Applications (LLM01–LLM10), OWASP Agentic AI Top 10 (ASI01–ASI10), NIST AI RMF
- Primary CWE Mapping: CWE-77 (Command Execution via Unvalidated LLM Output), CWE-79 (XSS via Unsanitized Markdown), CWE-269 (Improper Privilege Management / Excessive Agency), CWE-200 (Sensitive Information Exposure)
- ViperClaw MCP Tools:
viper_taint_scan,viper_oob_probe,viper_verify_and_report - ViperClaw CLI Command:
viperclaw taint ./src --db .viperclaw/graph.db
2. Threat Model & Root-Cause Architecture
flowchart LR
User["User Prompt + Untrusted RAG Data"] --> LLM["LLM Reasoning Layer"] --> Schema["Deterministic Tool Policy & Schema Gate"] --> Downstream["Parameterized API / Sanitized UI"]Root-Cause Analysis
Guardrail failures occur when applications treat model-generated strings as trusted instructions—passing unvalidated LLM output directly into SQL engines (SQLDatabaseChain), dynamic code runners (PythonREPLTool), unescaped Markdown/HTML renderers, or over-privileged internal APIs without caller-scoped authorization.
3. Deterministic Discovery & Grep/AST Audit Commands
Run the following discovery commands across the target repository before manual code review:
# 1. Automated ViperClaw analysis
viperclaw taint ./src --db .viperclaw/graph.db
# 2. Rapid static pattern discovery (ripgrep)
rg -n "(openai\.|anthropic\.|ChatCompletion|generate_content|LangChain|LlamaIndex)"
rg -n "(create_sql_agent|SQLDatabaseChain|PythonREPLTool|ShellTool|BashProcess)"
rg -n "(system_prompt|tools\s*=\s*\[|function_call|tool_choice)"4. Senior Security Engineer 8-Point Audit Checklist
| Control ID | Audit Verification Target | Pass Criteria | Fail / Vulnerability Indicator |
LLM-01 | Prompt & Untrusted Data Separation (LLM01) | External content (emails, web pages, RAG documents) is wrapped in explicit structural delimiters and separated from system instructions. | Untrusted external text concatenated directly into the system instruction block. |
LLM-02 | Output Sanitization & Safe Rendering (LLM02) | Model output is sanitized (DOMPurify) before DOM rendering and never passed into eval(), exec(), or raw SQL. | Markdown output containing active <script>, javascript: links, or unapproved external image URLs rendered verbatim. |
LLM-03 | Least-Privilege Agency & Tool Scoping (LLM08 / ASI03) | Tools run under the authenticated caller's RBAC/tenant token, never a global admin service key. | Assistant uses a master database connection or service-role key to query tables on behalf of any user. |
LLM-04 | Human-in-the-Loop (HITL) on State Changes | Tools that send messages, transfer funds, modify permissions, or delete records require explicit user confirmation in the UI. | Untrusted document instructions automatically invoke state-mutating tool calls without confirmation. |
LLM-05 | No Secrets in System Instructions (LLM06) | API keys, database credentials, and proprietary secrets are stored outside system prompts. | System instruction text embeds API tokens or internal service credentials. |
LLM-06 | Text-to-SQL Read-Only & Row-Level Isolation | Natural-language-to-SQL features use a read-only DB role (SELECT only) with PostgreSQL Row-Level Security (RLS) enforced. | Model-generated SQL executed on a read-write DB connection without tenant RLS. |
LLM-07 | Token Budget & Bounded Iteration Caps (LLM04) | Per-user rate limits, max_tokens caps, and maximum agent tool-loop iterations (max_steps <= 10) enforced. | Unbounded recursive agent loops or oversized prompt inputs exhausting API budgets. |
LLM-08 | Image & Markdown Egress CSP | Chat UI enforces a strict CSP img-src 'self' data: so rendered Markdown cannot trigger unapproved outbound requests via query strings. | Unsanitized external Markdown image URLs auto-fetched by the browser containing session context. |
5. False-Positive Elimination & CVSS v3.1 Triage Rubric
False-Positive Gate
- Verify whether an upstream API Gateway, global middleware, or ORM hook already enforces the control before flagging a controller.
- Confirm the code path is reachable from an external entrypoint (not dead code, CLI-only admin script, or unit-test fixture).
| Severity Tier | Baseline CVSS v3.1 Vector | Qualifying Security Impact |
| CRITICAL (9.6) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H | Unvalidated model output passed to PythonREPLTool / ShellTool or raw read-write SQL connection causing unauthorized execution or DB access. |
| HIGH (8.1) | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N | Untrusted prompt boundary crossing causing unauthorized state changes or cross-tenant RAG data disclosure. |
| MEDIUM (5.4) | CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N | Unsanitized model Markdown output allowing client-side script execution or external image tracking. |
6. Production Remediation Patterns (Vulnerable vs. Hardened Code)
# ❌ VULNERABLE: Executes model-generated SQL using a global admin connection without RLS
def run_ai_analytics(user_question: str) -> list:
sql_query = llm.generate_sql(prompt=user_question)
return admin_db.execute(sql_query).fetchall()
# ✅ HARDENED: Read-only transaction + PostgreSQL session tenant RLS binding + statement timeout
def run_ai_analytics(user_question: str, session: VerifiedSession) -> list:
sql_query = llm.generate_sql(prompt=user_question)
with readonly_db.transaction() as conn:
conn.execute("SET LOCAL statement_timeout = '3000ms'")
conn.execute("SELECT set_config('app.current_tenant_id', %s, true)", (str(session.tenant_id),))
return conn.execute(sql_query).fetchall()7. Regression Testing & Continuous Verification
- Write a Positive Unit Test confirming authorized, schema-valid requests succeed.
- Write a Negative Security Regression Test confirming unauthorized, cross-tenant, or malformed inputs are deterministically rejected.
- Re-run
viperclaw taintandviperclaw verifyto confirm zero remaining unmitigated flows in.viperclaw/graph.db.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

