后端审计
- 作者仓库星标 0
- 作者更新于 实时读取
- 作者仓库 skills-registry
- 领域
- 安全
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @tomevault-io · 未声明 license
- Token 消耗评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 需要 · Vendor-specific
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- Python
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- 读取环境变量
- 网络行为
- 允许外网请求
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: django-smoke-alarm
description: Run and triage Django/DRF security smoke checks for settings hardening, throttling, safe HTML, O…
category: 安全
runtime: Python
---
# django-smoke-alarm 输出预览
## PART A: 任务判断
- 适用问题:安全审计、密钥扫描、权限检查或风险分析。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“When to Use / Core Rule / Phase 1: Prepare a Clean Scan”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于安全审计、密钥扫描、权限检查或风险分析,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“When to Use / Core Rule / Phase 1: Prepare a Clean Scan”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、读取环境变量、会按任务需要访问外部网络、需要准备 Vendor-specific API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、读取环境变量;会按任务需要访问外部网络;需要准备 Vendor-specific API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/tmp` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、读取环境变量。
先用一个小任务确认它会围绕“When to Use / Core Rule / Phase 1: Prepare a Clean Scan”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: django-smoke-alarm
description: Run and triage Django/DRF security smoke checks for settings hardening, throttling, safe HTML, O…
category: 安全
source: tomevault-io/skills-registry
---
# django-smoke-alarm
## 什么时候使用
- 把安全方向的常用动作沉淀成 Agent 可调用的技能 适合处理安全审计、密钥扫描、权限检查和风险分析,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代的步骤;使用前…
- 面向安全审计、密钥扫描、权限检查或风险分析,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「When to Use / Core Rule / Phase 1: Prepare a Clean Scan」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、读取环境变量;会按任务需要访问外部网络;需要准备 Vendor-specific API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "django-smoke-alarm" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> When to Use / Core Rule / Phase 1: Prepare a Clean Scan
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> Python | 读取文件、写入/修改文件、读取环境变量 | 会按任务需要访问外部网络
安全层 -> 需要准备 Vendor-specific API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Django Smoke Alarm
Use this when a Django or DRF project needs a fast security/reliability sweep, especially after a tool such as djangoSecurityHunter, Bandit, Semgrep, or a custom grep pass reports many findings.
Third-order stance: the goal is not “make the scanner green.” The goal is to find the few boring Django foot-guns that become production incidents, while teaching the project a repeatable preflight. Smoke alarms should be loud, cheap, and easy to silence only with evidence.
When to Use
- The project is Django/DRF and you need obvious security or reliability issues.
- A scanner reports many findings and you need a grounded triage.
- Before launch, deploy, CI hardening, or exposing new auth/API/upload/HTML surfaces.
- When adding or reviewing settings, DRF auth, OAuth/API keys, XML/Markdown/HTML rendering, import jobs, or admin previews.
Core Rule
Always classify scanner output before fixing:
- REAL — plausible exploit/data-loss/abuse path or broken production posture.
- HYGIENE — low-risk but worth making safer/clearer, often to reduce future mistakes.
- FALSE POSITIVE — scanner pattern is misleading; document why with code evidence.
Do not create a giant undifferentiated fix list. The dragon is usually three lizards in a trench coat.
Phase 1: Prepare a Clean Scan
Never judge raw scanner counts from a working repo if it contains worktrees or generated/vendor folders.
Exclude at minimum:
.git .hg .svn .venv venv node_modules dist build .tox .eggs
.mypy_cache .pytest_cache htmlcov coverage
.worktrees .claude/worktrees
.env .env.*
If using djangoSecurityHunter, prefer a clean temp copy and scan-only env values:
python3 skills/django-smoke-alarm/scripts/django_smoke_alarm.py \
--project . \
--settings myproject.settings \
--project-python .venv/bin/python \
--scanner-source /tmp/djangoSecurityHunter/src \
--env SECRET_KEY=dummy-scan-only-not-production-40-plus-chars \
--env DEBUG=False \
--env ALLOWED_HOSTS=localhost,127.0.0.1 \
--env DATABASE_URL=sqlite:////tmp/django-smoke.sqlite3
If the scanner cannot import settings, keep static findings but explicitly say which settings-backed checks were skipped.
Phase 2: Read the Rule Buckets, Not Just Counts
Group findings by risk surface:
- Production settings —
DEBUG,SECRET_KEY,ALLOWED_HOSTS, HTTPS redirect, HSTS, secure cookies, CSRF trusted origins, CORS. - DRF/API abuse — default authentication, permissions, throttles, pagination, auth-like routes, upload limits.
- Unsafe HTML —
mark_safe,|safe, XML/Markdown renderers, admin previews, template tags, rich text blocks. - Persistence races —
exists/get + create, multi-save workflows,save()in loops, arithmetic updates withoutF(), missing uniqueness/idempotency. - Model integrity — natural-key slugs, nullable unique-ish fields, risky cascade deletes, missing constraints.
- Secrets/logging — token-looking defaults, exception logs near OAuth/API keys, local
.env*accidentally tracked. - Dependencies and external scanners — pip-audit, Bandit, Semgrep, only after the clean project scan is understood.
Phase 3: Sample Before Fixing
For each noisy rule, inspect representative code before deciding.
Unsafe HTML triage
Classify as REAL if untrusted or external content is inserted into safe HTML without escaping:
- XML or Markdown source from outside the team
- user profile/team/org/bill/client fields
- uploaded file metadata
- admin preview fields backed by user content
Classify as HYGIENE if the string is constant or all interpolated variables are escaped, but the code would be safer with format_html() / format_html_join().
Classify as FALSE POSITIVE only when the full data path is safe and future edits are unlikely to reintroduce unsafe interpolation.
Transaction/race triage
Do not blindly wrap long-running workflows in transaction.atomic(). Multi-save progress markers around external API calls, Celery jobs, or imports may be intentional.
Prefer:
- DB uniqueness constraints for idempotency.
get_or_create()/update_or_create()where appropriate.select_for_update()for concurrent mutation of existing rows.F()expressions for arithmetic updates.- Small atomic sections around related DB writes, not around network calls or long LLM/image work.
Phase 4: Produce a Triage Table
Report a compact table:
| Finding | Classification | Evidence | Recommended move |
|---|---|---|---|
| Missing HSTS | REAL | settings.py has no SECURE_HSTS_SECONDS under DEBUG=False |
Add production security block or env-controlled settings |
Admin mark_safe preview |
HYGIENE | URL is escaped, constant HTML otherwise | Convert to format_html |
| AI pipeline multiple saves | FALSE POSITIVE/HYGIENE | Saves status before/after long external calls | Do not wrap whole function; maybe add comment/tests |
Then list only the top 3-7 REAL fixes. Put hygiene work behind those.
Phase 5: Turn Findings into Project Policy
If the same issue could recur, add a project-local guardrail:
settings.pyproduction security block and test.- DRF throttle defaults and per-route throttles for auth/OAuth/API-key endpoints.
- HTML renderer helper that escapes text by default and marks only known tags safe.
- Code-review note: “no
mark_safewith interpolation; useformat_html.” - Import/idempotency tests with duplicate input and repeated runs.
- CI smoke-alarm job that runs on a clean copy and stores JSON/SARIF artifacts.
scripts/django_smoke_alarm.py creates a clean temp copy, runs djangoSecurityHunter if available, writes JSON, and prints a grouped summary. It is intentionally a wrapper, not the source of truth: the agent still must read code and classify findings.
Useful flags:
--project— Django repo root.--settings— Django settings module.--project-python— project venv Python, recommended for settings import.--scanner-source— localdjangoSecurityHunter/srccheckout to add toPYTHONPATH.--env KEY=VALUE— scan-only env overrides.--output-dir— report destination.
- Use
trust-auditfor user-facing permission, privacy, billing, and unsafe-feeling AI/data flows found during the scan. - Use
kindness-checkafter fixes to catch developer/support burden from noisy scanner-driven changes. - Use
release-operatorif this creates a CI/release gate. - Use
decision-logif choosing to accept a scanner false positive or defer a real risk.
Source: carlkibler/agent-skills — distributed by TomeVault.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核