/viperclaw:viper-openapi-rest-schemafrom viperclaw
Audits OpenAPI/Swagger schemas for mass assignment vulnerabilities (OWASP API3 & API4), DTO allowlisting, pagination caps, and schema validation in REST APIs.
Ships in viperclaw. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
viper-openapi-rest-schema)viper_taint_scan, viper_diff_oracle, viper_verify_and_reportviperclaw taint ./src --db .viperclaw/graph.dbflowchart LR
Client["Client JSON Request"] --> InDTO["Strict Input DTO (additionalProperties: false)"] --> ORM["Explicit Field Mapping"] --> OutDTO["Redacted Output DTO Serializer"]
REST controllers bind raw request JSON directly into database ORM objects (User(**req.json), Object.assign(entity, req.body)), allowing callers to overwrite protected columns (role, is_admin, tenant_id, email_verified, balance), or return raw ORM entities that serialize password_hash, mfa_secret, and PII.
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 "(\*\*request\.(json|get_json)|Object\.assign\(user,\s*req\.body|Model\.create\(req\.body)"
rg -n "(swagger-ui|openapi\.json|/docs|/redoc|api-docs)"
rg -n "(extra\s*=\s*.allow.|additionalProperties\s*:\s*true)"
| Control ID | Audit Verification Target | Pass Criteria | Fail / Vulnerability Indicator |
|---|---|---|---|
API-01 | Input DTO Property Allowlisting (No Mass Assignment) | Every POST/PUT/PATCH route binds to a dedicated Input DTO that explicitly lists editable user fields and sets extra='forbid' / additionalProperties: false. | ORM model updated directly from req.body or request.json. |
API-02 | Output Serializer DTO (No Excessive Data Exposure) | Every read/list endpoint serializes through an explicit Output DTO that excludes password_hash, mfa_secret, reset_token, and internal metadata. | Controller returns raw database row (SELECT * / return db_user) to the JSON serializer. |
API-03 | Pagination & Batch Size Caps (OWASP API4) | List endpoints enforce 1 <= limit <= 100 and cap maximum offset or use cursor pagination. | GET /api/users?limit=10000000 allowed, exhausting database memory and worker threads. |
API-04 | Production Swagger / OpenAPI UI Access Control | Interactive /docs, /redoc, /swagger-ui.html, and /openapi.json are disabled in production or gated behind internal authentication. | Unauthenticated /swagger-ui in production exposing internal admin and debug endpoints. |
API-05 | Strict JSON Type & Bound Validation | Strings enforce minLength/maxLength and regex patterns; numbers enforce minimum/maximum and reject NaN/Infinity. | Unbounded 50MB string field or negative numeric value accepted by API schema. |
API-06 | API Version Lifecycle & Shadow API Retirement | Legacy API versions (/api/v1/*, /api/beta/*) are decommissioned or share the exact same auth/rate-limit middleware as /api/v2/*. | Deprecated /api/v1/login remains online without MFA or rate limiting. |
API-07 | JSON Patch (application/json-patch+json) Path Guard | If RFC 6902 JSON Patch is used, path pointers (/role, /tenantId) are validated against an editable field allowlist. | Unfiltered [{ "op": "replace", "path": "/isAdmin", "value": true }] applied to entity. |
API-08 | Uniform 401/403/422 Error Schema | Validation errors (422) do not echo back internal server configuration or full raw database constraints. | Pydantic/Hibernate error response leaks internal class paths or SQL constraint names. |
| Severity Tier | Baseline CVSS v3.1 Vector | Qualifying Security Impact |
|---|---|---|
| CRITICAL (9.1) | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N | Mass assignment on user profile/registration overwriting role: "admin", is_superuser: true, or tenant_id. |
| HIGH (7.5) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N | Excessive data exposure returning password_hash, api_key, or mfa_secret in /api/users response. |
| MEDIUM (5.3) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L | Uncapped pagination (limit=999999) or exposed internal Swagger documentation. |
# ❌ VULNERABLE: Updates ORM user directly from raw dict & returns full ORM model (with password_hash!)
@router.patch("/users/me")
def update_me(req_body: dict, user: User = Depends(get_current_user), db: Session = Depends(get_db)):
for k, v in req_body.items():
setattr(user, k, v) # Untrusted caller sends {"is_admin": True, "balance": 999999}
db.commit()
return user
# ✅ HARDENED: Strict Input DTO (extra='forbid') + Explicit Output DTO
class UserUpdateInput(BaseModel):
model_config = ConfigDict(extra="forbid")
display_name: str = Field(min_length=1, max_length=80)
bio: str = Field(default="", max_length=500)
class UserPublicOutput(BaseModel):
id: UUID
display_name: str
bio: str
@router.patch("/users/me", response_model=UserPublicOutput)
def update_me(req_body: UserUpdateInput, user: User = Depends(get_current_user), db: Session = Depends(get_db)):
user.display_name = req_body.display_name
user.bio = req_body.bio
db.commit()
return user
viperclaw taint and viperclaw verify to confirm zero remaining unmitigated flows in .viperclaw/graph.db.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
openapi, swagger, mass-assignment, api-security, dto-validation
72 skills in this plugin
/viper-agent-skill-supplychainAI Agent Skill, Plugin & MCP Config Supply-Chain Auditor (modeled on NVIDIA SkillSpector & OWASP Agentic Skills Top 10). Audits SKILL.md bundles and MCP JSON configs./viper-ai-llm-guardrailsAI, LLM & MCP Application Security & Guardrails Auditor (OWASP LLM Top 10). Reviews prompt boundaries, RAG data isolation, tool-call authorization, and output sanitization./viper-api-gateway-apigee-kongAPI Gateway, BFF & Rate-Tier Policy Auditor (Kong, AWS API Gateway, Apigee, Envoy Gateway). Reviews JWT authorizers, backend origin lockdown, and route-level quotas.npx claudepluginhub zahidoverflow/viperclaw --plugin viperclawOther plugins' skills for the same job