audit-code

TotalClaw 作者 totalclaw

针对硬编码机密、危险调用和常见漏洞进行以安全为中心的代码审查

安装 / 下载方式

TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~itsnishi-audit-code
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~itsnishi-audit-code/file -o itsnishi-audit-code.md
# audit-code -- Project Code Security Review

Security-focused code review of project source code. Covers OWASP-style vulnerabilities, hardcoded secrets, dangerous function calls, and patterns relevant to AI-assisted development.

## What to do

Run the auditor against the target path:

```bash
python3 "$SKILL_DIR/scripts/audit_code.py" "$ARGUMENTS"
```

If `$ARGUMENTS` is empty, default to `$PROJECT_ROOT`.

## What it checks

- **Hardcoded secrets** -- API keys (AWS, GitHub, Stripe, OpenAI, Slack), tokens, private keys, connection strings, passwords
- **Dangerous function calls** -- eval, exec, subprocess with shell=True, child_process.exec, pickle deserialization, system(), gets(), etc.
- **SQL injection** -- String concatenation/interpolation in SQL queries
- **Dependency risks** -- Known hallucinated package names, unverified installations
- **Sensitive files** -- .env files committed to git, credential files in repo
- **File permissions** -- Overly permissive chmod patterns
- **Exfiltration patterns** -- Base64 encode + network send, DNS exfiltration, credential file reads

## Output

Structured report with severity-ranked findings, file locations, and actionable remediation steps.

## When to use

- Before committing or pushing code
- When reviewing third-party contributions or PRs
- As part of a periodic security audit of the codebase
- After AI-assisted code generation to verify no secrets or vulnerabilities were introduced

---

## 中文说明

# audit-code -- 项目代码安全审查

对项目源代码进行以安全为中心的代码审查。涵盖 OWASP 风格的漏洞、硬编码机密、危险函数调用,以及与 AI 辅助开发相关的模式。

## 操作步骤

针对目标路径运行审计器:

```bash
python3 "$SKILL_DIR/scripts/audit_code.py" "$ARGUMENTS"
```

如果 `$ARGUMENTS` 为空,则默认使用 `$PROJECT_ROOT`。

## 检查内容

- **硬编码机密** -- API 密钥(AWS、GitHub、Stripe、OpenAI、Slack)、令牌、私钥、连接字符串、密码
- **危险函数调用** -- eval、exec、shell=True 的 subprocess、child_process.exec、pickle 反序列化、system()、gets() 等
- **SQL 注入** -- SQL 查询中的字符串拼接/插值
- **依赖风险** -- 已知的幻觉包名、未经验证的安装
- **敏感文件** -- 提交到 git 的 .env 文件、仓库中的凭据文件
- **文件权限** -- 过于宽松的 chmod 模式
- **数据外泄模式** -- Base64 编码 + 网络发送、DNS 外泄、凭据文件读取

## 输出

结构化报告,包含按严重程度排序的发现项、文件位置以及可操作的修复步骤。

## 使用场景

- 提交或推送代码之前
- 审查第三方贡献或 PR 时
- 作为对代码库进行定期安全审计的一部分
- 在 AI 辅助生成代码后,验证未引入任何机密或漏洞