Setup
On first use, read setup.md for integration guidelines.
If local memory is needed, ask for consent before creating ~/security-best-practices/.
When to Use
Use this skill for secure-by-default implementation, targeted vulnerability reviews, and prioritized security reports with actionable fixes. Activate when the user requests security guidance, hardening, risk triage, or remediation planning.
Architecture
Memory lives in ~/security-best-practices/. See memory-template.md for setup.
CODEBLOCK0
Quick Reference
Load only the minimum file needed for the current request.
| Topic | File |
|---|
| Setup process | INLINECODE4 |
| Memory template |
memory-template.md |
| Full review workflow |
review-playbook.md |
| Severity model and scoring |
severity-model.md |
| Safe remediation patterns |
remediation-patterns.md |
| Risk exception log |
exceptions.md |
Core Rules
1. Establish Scope and Evidence First
Before any conclusions, confirm:
- - System boundary (service, module, endpoint, or workflow)
- Stack evidence (language, framework, deployment context)
- Threat assumptions (external attacker, internal misuse, privilege level)
No evidence, no finding.
2. Map Risks to a Repeatable Baseline
Evaluate every review against a consistent baseline:
- - Authn/authz boundaries
- Input validation and output encoding
- Secrets handling and configuration safety
- Dependency and supply chain posture
- Logging, error handling, and data exposure controls
Use review-playbook.md to keep scans systematic instead of ad hoc.
3. Produce Findings That Are Verifiable
Each finding must include:
- - Severity from INLINECODE11
- File path and line references
- Concrete evidence snippet
- Impact statement in plain language
- Minimal safe fix direction
Avoid speculative findings without repository evidence.
4. Prioritize Exploitability Over Theory
Rank by practical risk, not by checklist volume:
- - Reachability from untrusted inputs
- Privilege required by attacker
- Blast radius if exploited
- Ease of abuse and repeatability
High confidence, exploitable issues come first.
5. Remediate With Minimal Product Risk
Fix one finding at a time:
- - Prefer small diffs that preserve existing behavior
- Add tests when security fixes alter code paths
- Flag expected behavior changes before implementing
- Re-run project validation after each fix batch
Use remediation-patterns.md for safe rollouts.
6. Respect Explicit Exceptions and Ownership
If the user accepts a known risk:
- - Record rationale in INLINECODE13
- Define expiry or next review date
- Keep the exception scoped to the specific context
Never apply broad silent overrides.
Security Review Traps
- - Reporting generic best practices without file evidence -> low-trust output that teams cannot action.
- Flooding with low-severity noise -> critical vulnerabilities get ignored.
- Proposing major refactors as "quick fixes" -> teams reject security work due to delivery risk.
- Ignoring framework defaults and deployment context -> false positives and wrong remediations.
- Declaring a system "secure" after one pass -> hidden regressions remain untested.
Security & Privacy
Data that leaves your machine:
- - None by default from this skill itself.
Data that stays local:
- - Review preferences and finding history in
~/security-best-practices/. - Exception rationale in local memory files only.
This skill does NOT:
- - Exfiltrate source code to undeclared third-party endpoints.
- Mark unresolved risks as fixed.
- Perform hidden destructive changes.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
auth - Authentication design and hardening. - INLINECODE17 - Access control and permission boundaries.
- INLINECODE18 - Key management and cryptographic hygiene.
- INLINECODE19 - Network exposure review and policy controls.
- INLINECODE20 - Secure delivery, CI checks, and operational safeguards.
Feedback
- - If useful: INLINECODE21
- Stay updated: INLINECODE22
技能名称:安全最佳实践
详细描述:
设置
首次使用时,请阅读 setup.md 获取集成指南。
如需本地存储,请在创建 ~/security-best-practices/ 前征得同意。
使用时机
本技能适用于默认安全实现、针对性漏洞审查,以及附带可操作修复方案的优先级安全报告。当用户请求安全指导、加固、风险分类或修复规划时激活。
架构
存储位于 ~/security-best-practices/。配置方法见 memory-template.md。
text
~/security-best-practices/
|- memory.md # 稳定上下文、偏好及激活边界
|- findings-log.md # 发现记录(含严重程度与状态)
- - exceptions.md # 已批准的安全例外及审查日期
快速参考
仅加载当前请求所需的最小文件。
| 主题 | 文件 |
|-------|------|
| 设置流程 | setup.md |
| 存储模板 | memory-template.md |
| 完整审查工作流 | review-playbook.md |
| 严重程度模型与评分 | severity-model.md |
| 安全修复模式 | remediation-patterns.md |
| 风险例外日志 | exceptions.md |
核心规则
1. 先确定范围与证据
在得出任何结论前,需确认:
- - 系统边界(服务、模块、端点或工作流)
- 技术栈证据(语言、框架、部署环境)
- 威胁假设(外部攻击者、内部滥用、权限级别)
无证据,不报告。
2. 将风险映射至可重复基线
基于一致基线评估每次审查:
- - 认证/授权边界
- 输入验证与输出编码
- 密钥处理与配置安全
- 依赖与供应链状况
- 日志、错误处理及数据暴露控制
使用 review-playbook.md 保持系统化扫描,避免临时操作。
3. 产出可验证的发现项
每项发现必须包含:
- - 来自 severity-model.md 的严重程度
- 文件路径与行号引用
- 具体证据片段
- 用通俗语言描述的影响说明
- 最小安全修复方向
避免缺乏仓库证据的推测性发现。
4. 优先考虑可利用性而非理论
按实际风险排序,而非检查清单数量:
- - 来自不可信输入的触达性
- 攻击者所需权限
- 被利用后的影响范围
- 滥用难易度与可重复性
高置信度、可被利用的问题优先处理。
5. 以最小产品风险进行修复
每次修复一个发现项:
- - 优先采用保留现有行为的小改动
- 安全修复改变代码路径时需添加测试
- 实施前标记预期的行为变更
- 每批修复后重新运行项目验证
使用 remediation-patterns.md 实现安全部署。
6. 尊重明确的例外与所有权
若用户接受已知风险:
- - 在 exceptions.md 中记录理由
- 定义到期日或下次审查日期
- 将例外限定在特定上下文中
切勿进行广泛的静默覆盖。
安全审查陷阱
- - 报告通用最佳实践但无文件证据 → 低信任度输出,团队无法执行。
- 充斥低严重性噪音 → 关键漏洞被忽视。
- 将重大重构作为“快速修复”提出 → 团队因交付风险拒绝安全工作。
- 忽略框架默认值与部署环境 → 误报与错误修复。
- 一次通过后即宣布系统“安全” → 隐藏的回归问题未经验证。
安全与隐私
离开本机的数据:
本地存储的数据:
- - 审查偏好与发现历史(位于 ~/security-best-practices/)。
- 例外理由(仅存于本地存储文件)。
本技能不会:
- - 将源代码泄露至未声明的第三方端点。
- 将未解决风险标记为已修复。
- 执行隐藏的破坏性更改。
相关技能
若用户确认,使用 clawhub install
安装:
- - auth - 认证设计与加固。
- authorization - 访问控制与权限边界。
- encryption - 密钥管理与加密规范。
- firewall - 网络暴露审查与策略控制。
- devops - 安全交付、CI 检查与运维防护。
反馈
- - 如有帮助:clawhub star security-best-practices
- 保持更新:clawhub sync