viper-graphql-ws
Skill22 starsChanged 15 days agoMITView on GitHub
GraphQL Schema & WebSocket Security Auditor. Reviews introspection exposure, query depth/complexity limits, batching controls, and WebSocket origin/authentication checks.
- Reads credentials
In this repository72 other files it gives its agents.
- llms.txtllms.txt
- viper-agent-skill-supplychainSkill
- viper-ai-llm-guardrailsSkill
- 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-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 100
Write a Positive Unit Test confirming authorized, schema-valid requests succeed.
- Distinctive: line 101
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
GraphQL Schema, Resolver AuthZ & WebSocket Security Auditor (viper-graphql-ws)
1. Executive Scope, Standards & CWE/OWASP Mapping
- Frameworks & Standards: OWASP GraphQL Cheat Sheet, OWASP WSTG-APIT-02, OWASP WebSocket Security Cheat Sheet, CWE-400, CWE-285
- Primary CWE Mapping: CWE-400 (Uncontrolled Resource Consumption via Deep/Batched Queries), CWE-285 (Improper Resolver Authorization), CWE-1385 (Missing Origin Validation in WebSockets / CSWSH)
- ViperClaw MCP Tools:
viper_graphql_scan,viper_diff_oracle,viper_verify_and_report - ViperClaw CLI Command:
viperclaw graphql https://api.example.com/graphql --output gql_audit.json
2. Threat Model & Root-Cause Architecture
flowchart LR
Query["GraphQL POST / WS Upgrade"] --> Limits["Depth, Cost & Batch Limiter"] --> Resolver["Field & Edge Resolver AuthZ"] --> Data["DataLoader & DB Layer"]Root-Cause Analysis
GraphQL exposes a single HTTP endpoint where clients dictate the query structure; without per-resolver authorization, query depth/cost caps, and batching limits, untrusted callers traverse deep circular object edges (user -> org -> members -> org) or batch thousands of mutations in one HTTP request.
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 graphql https://api.example.com/graphql --output gql_audit.json
# 2. Rapid static pattern discovery (ripgrep)
rg -n "(ApolloServer|GraphQLSchema|graphene\.|strawberry\.|ariadne)"
rg -n "(introspection\s*:|NoIntrospection|depthLimit|costAnalysis)"
rg -n "(WebSocketServer|ws\.on\(|@WebSocketGateway|accept\(\))"4. Senior Security Engineer 8-Point Audit Checklist
| Control ID | Audit Verification Target | Pass Criteria | Fail / Vulnerability Indicator |
GQL-01 | Production Introspection & Clairvoyance Control | Introspection (__schema, __type) and verbose 'Did you mean...?' field suggestions disabled in production for unprivileged callers. | Full schema or field-suggestion hints exposed on production /graphql. |
GQL-02 | Query Depth & Cyclical Edge Limit | graphql-depth-limit (e.g., max_depth = 7) enforced before query execution. | Circular relationships (User -> Posts -> Author -> Posts) queryable to depth 50+ causing CPU/DB exhaustion. |
GQL-03 | Alias & Array Batching Caps | JSON array batching ([{query}, ...]) and field alias count per operation capped (e.g., <= 10 aliases). | 1,000 login or verifyOtp mutations batched via aliases in a single HTTP request, circumventing per-request rate limits. |
GQL-04 | Field & Edge-Level Authorization | Every object resolver (User.email, Organization.billing, nested edges) checks caller permissions. | Auth checked only on top-level Query while nested edges leak cross-tenant fields. |
GQL-05 | Persisted Queries / Operation Allowlisting | Production first-party apps use Automatic Persisted Queries (APQ) or strict operation allowlists. | Arbitrary ad-hoc GraphQL ASTs accepted from untrusted clients. |
GQL-06 | WebSocket Handshake Origin Validation (CSWSH) | WebSocket Upgrade handler strictly validates the Origin header against an exact allowlist. | Cookie-authenticated WebSocket accepts connections from any Origin (Cross-Site WebSocket reuse / CSWSH). |
GQL-07 | WebSocket Subscription Tenant Scoping | graphql-ws / Socket.IO subscription channels verify caller authorization for the subscribed topic/tenant ID. | Any connected client can subscribe to orderUpdated(orgId: "other_org"). |
GQL-08 | Error Masking in Resolvers | Unhandled resolver exceptions are masked (formatError) so SQL errors and internal paths are not returned in errors[].extensions. | Raw stack traces and database constraint errors exposed in GraphQL errors array. |
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 |
| HIGH (8.1) | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N | Missing nested resolver authorization allowing cross-tenant data access or mutation. |
| HIGH (7.5) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H | Uncapped alias amplification or recursive depth bomb causing single-request service outage. |
| MEDIUM (6.5) | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N | Cross-Site WebSocket origin validation gap (CSWSH) due to missing Origin validation on cookie-authenticated WS. |
6. Production Remediation Patterns (Vulnerable vs. Hardened Code)
// ❌ VULNERABLE: Introspection enabled, no depth/alias limits, and WS accepts any Origin
const server = new ApolloServer({
typeDefs,
resolvers,
introspection: true,
});
// ✅ HARDENED: Disables introspection in prod, enforces depth/alias caps & masks internal errors
import depthLimit from "graphql-depth-limit";
const server = new ApolloServer({
typeDefs,
resolvers,
introspection: process.env.NODE_ENV !== "production",
validationRules: [depthLimit(6)],
formatError: (formattedError) => ({
message: formattedError.message,
code: formattedError.extensions?.code || "INTERNAL_ERROR",
}),
});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.

