返回顶部
🇺🇸 English
🇨🇳 简体中文
🇨🇳 繁體中文
🇺🇸 English
🇯🇵 日本語
🇰🇷 한국어
🇫🇷 Français
🇩🇪 Deutsch
🇪🇸 Español
🇷🇺 Русский
n

nodejs-security-audit

Audit Node.js HTTP servers and web apps for security vulnerabilities. Checks OWASP Top 10, CORS, auth bypass, XSS, path traversal, hardcoded secrets, missing headers, rate limiting, and input validation. Use when reviewing server code before deployment or after changes.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
644
下载量
0
收藏
概述
安装方式
版本历史

nodejs-security-audit

# Node.js Security Audit Structured security audit for Node.js HTTP servers and web applications. ## Audit Checklist ### Critical (Must Fix Before Deploy) **Hardcoded Secrets** - Search for: API keys, passwords, tokens in source code - Pattern: `grep -rn "password\|secret\|token\|apikey\|api_key" --include="*.js" --include="*.ts" | grep -v node_modules | grep -v "process.env\|\.env"` - Fix: Move to env vars, fail if missing: `if (!process.env.SECRET) process.exit(1);` **XSS in Dynamic Content** - Search for: `innerHTML`, template literals injected into DOM, unsanitized user input in responses - Fix: Use `textContent`, or escape: `str.replace(/[&<>"']/g, c => ({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":"&#39;"}[c]))` **SQL/NoSQL Injection** - Search for: String concatenation in queries, `eval()`, `Function()` with user input - Fix: Parameterized queries, input validation ### High (Should Fix) **CORS Misconfiguration** - Search for: `Access-Control-Allow-Origin: *` - Fix: Allowlist specific origins: `const origin = ALLOWED.has(req.headers.origin) ? req.headers.origin : ALLOWED.values().next().value` **Auth Bypass** - Check: Every route that should require auth actually checks it - Common miss: Static file routes, agent/webhook endpoints, health checks that expose data **Path Traversal** - Check: `path.normalize()` + `startsWith(allowedDir)` on all file-serving routes - Extra: Resolve symlinks with `fs.realpathSync()` and re-check ### Medium (Recommended) **Security Headers** ```javascript const HEADERS = { 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'Permissions-Policy': 'camera=(), microphone=(), geolocation=()', }; // Apply to all responses ``` **Rate Limiting** ```javascript const attempts = new Map(); // ip -> { count, resetAt } const LIMIT = 5, WINDOW = 60000; function isLimited(ip) { const now = Date.now(), e = attempts.get(ip); if (!e || now > e.resetAt) { attempts.set(ip, {count:1, resetAt:now+WINDOW}); return false; } return ++e.count > LIMIT; } ``` **Input Validation** - Body size limits: `if (bodySize > 1048576) { req.destroy(); return; }` - JSON parse in try/catch - Type checking on expected fields ### Low (Consider) **Dependency Audit:** `npm audit` **Error Leakage:** Don't send stack traces to clients in production **Cookie Security:** `HttpOnly; Secure; SameSite=Strict` ## Report Format ``` ## Security Audit: [filename] ### Critical 1. **[Category]** Description — File:Line — Fix: ... ### High ... ### Medium ... ### Low ... ### Summary X critical, X high, X medium, X low ```

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 nodejs-security-audit-1776291367 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 nodejs-security-audit-1776291367 技能

通过命令行安装

skillhub install nodejs-security-audit-1776291367

下载 Zip 包

⬇ 下载 nodejs-security-audit v1.0.0

文件大小: 2.3 KB | 发布时间: 2026-4-16 18:14

v1.0.0 最新 2026-4-16 18:14
- Initial release of nodejs-security-audit.
- Audits Node.js HTTP servers for common vulnerabilities including OWASP Top 10 risks.
- Checks for hardcoded secrets, XSS, SQL/NoSQL injection, CORS issues, auth bypass, and path traversal.
- Verifies presence of security headers, rate limiting, and input validation.
- Includes guidance for dependency audits, error leakage prevention, and cookie security.
- Provides a structured checklist and example report format for audits.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部