/viperclaw:viper-js-harvesterfrom viperclaw
Audits client-side JavaScript bundles for security issues: leaked secrets, DOM XSS sinks, exposed routes, and source map hygiene. Reviews Webpack, Vite, and Next.js build artifacts.
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-js-harvester)viper_harvest_js, viper_browser_ingest, viper_graph_upsert, viper_verify_and_reportviperclaw harvest-js ./dist --base-url https://app.example.com/ --db .viperclaw/graph.db --output js_audit.jsonflowchart LR
Source["URL Hash / postMessage / Storage"] --> Router["SPA Client Router & Chunks"] --> Sink["innerHTML / eval / fetch()"] --> DOM["Browser DOM & Credential Store"]
Modern bundlers (Webpack, Vite, Next.js, Rollup) inline NEXT_PUBLIC_* / VITE_* environment variables at build time and emit code-split chunk manifests (webpackChunk, _buildManifest.js) that expose internal routes, unreleased admin views, and unvalidated DOM sinks.
Run the following discovery commands across the target repository before manual code review:
# 1. Automated ViperClaw analysis
viperclaw harvest-js ./dist --base-url https://app.example.com/ --db .viperclaw/graph.db --output js_audit.json
# 2. Rapid static pattern discovery (ripgrep)
rg -n "(dangerouslySetInnerHTML|innerHTML\s*=|outerHTML\s*=|document\.write\()"
rg -n "addEventListener\(\s*.message."
rg -n "(NEXT_PUBLIC_|VITE_|REACT_APP_)[A-Z0-9_]*(KEY|SECRET|TOKEN|PRIVATE)"
| Control ID | Audit Verification Target | Pass Criteria | Fail / Vulnerability Indicator |
|---|---|---|---|
JS-01 | Build-Time Env Leak Audit | No private keys or backend tokens prefixed with NEXT_PUBLIC_, VITE_, or REACT_APP_. | Service-role keys, Stripe secret keys, or internal tokens embedded in .js bundles. |
JS-02 | Production Source Map Hygiene | .js.map source maps disabled in public production builds or restricted to internal error trackers. | Publicly downloadable .js.map files exposing full proprietary TypeScript source and comments. |
JS-03 | Lazy-Chunk Route Authorization | All administrative or debug routes referenced in lazy chunks enforce server-side RBAC. | Client-side-only route guards (if (user.isAdmin)) protecting sensitive API endpoints. |
JS-04 | DOM HTML Sink Sanitization | Uses of innerHTML / dangerouslySetInnerHTML sanitize inputs via DOMPurify.sanitize(). | Raw user/API HTML injected directly into DOM nodes. |
JS-05 | postMessage Origin & Source Checks | window.addEventListener('message') validates exact event.origin and schema. | Wildcard or substring .includes() origin check on incoming postMessage events. |
JS-06 | Client Redirect & javascript: URI Guard | Dynamic href / window.location.assign values validate http:/https: protocol. | Unvalidated redirect_url allowing javascript: execution in <a href={url}>. |
JS-07 | Client Token Storage Security | Session tokens stored in HttpOnly; Secure; SameSite cookies rather than localStorage. | Long-lived JWTs or refresh tokens stored in window.localStorage. |
JS-08 | Subresource Integrity (SRI) | External third-party <script> tags include integrity="sha384-..." and crossorigin. | Unpinned third-party CDN scripts loaded without SRI hashes. |
| Severity Tier | Baseline CVSS v3.1 Vector | Qualifying Security Impact |
|---|---|---|
| CRITICAL (9.1) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N | Production cloud/database service-role secret key hardcoded in public JS bundle. |
| HIGH (7.5) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N | Unloaded admin lazy chunk reveals unauthenticated internal API endpoints leaking PII. |
| MEDIUM (6.1) | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N | DOM-based XSS via unvalidated window.postMessage or location.search into innerHTML. |
| LOW (3.7) | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N | Public .js.map source maps exposed without sensitive credentials. |
// ❌ VULNERABLE: Substring origin check & direct innerHTML sink in postMessage handler
window.addEventListener("message", (event) => {
if (event.origin.indexOf("example.com") !== -1) {
document.getElementById("preview")!.innerHTML = event.data.html;
}
});
// ✅ HARDENED: Strict origin allowlist + DOMPurify sanitization
import DOMPurify from "dompurify";
const ALLOWED_ORIGINS = new Set(["https://app.example.com", "https://portal.example.com"]);
window.addEventListener("message", (event: MessageEvent) => {
if (!ALLOWED_ORIGINS.has(event.origin)) return;
if (typeof event.data?.html === "string") {
const clean = DOMPurify.sanitize(event.data.html, { USE_PROFILES: { html: true } });
document.getElementById("preview")!.innerHTML = clean;
}
});
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
bundle-audit, dom-xss, secret-leak, source-map, spa-security
npx claudepluginhub zahidoverflow/viperclaw --plugin viperclaw72 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.Other plugins' skills for the same job