Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/bestcarly/opc-coding-guide/securitygit clone --depth 1 https://github.com/bestcarly/opc-coding-guideWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.01355 | $0.01355 |
| Opus 5 | $0.00678 | $0.00678 |
| Sonnet 5 | $0.00271 | $0.00271 |
| Haiku 4.5 | $0.00136 | $0.00136 |
Grade A, and why
security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 186 lines — stays where its author put it; the contents beside it link to each section on GitHub.
安全规则(2026 年版)
补充人:墨铃 (Mori)
补充日期:2026-02-28
参考章节:第八章 8.2 节、第十一章 11.5 节
输入验证
- 所有用户输入必须验证,不信任任何外部数据
- 使用 Zod 或 Joi 进行 schema 验证
- 防止 SQL 注入:使用参数化查询 / ORM
- 防止 XSS:转义输出,使用 Content Security Policy
- 防止命令注入:避免 shell 命令拼接,使用安全 API
// ✅ 正确:使用 Zod 验证
import { z } from "zod";
const UserInputSchema = z.object({
email: z.string().email(),
password: z.string().min(12).max(128),
name: z.string().min(1).max(100).regex(/^[\p{L}\s'-]+$/u),
});
// ❌ 错误:直接使用未验证输入
const user = await db.query(`SELECT * FROM users WHERE id = ${req.params.id}`);
认证授权
- 使用 JWT 认证,Access Token 过期时间:15 分钟
- Refresh Token 过期时间:7 天,存储在 HttpOnly Cookie
- 密码用 bcrypt 或 argon2 加密(bcrypt salt rounds ≥ 12)
- 敏感操作需要二次验证(MFA / TOTP)
- 登录限流:5 次失败后锁定 15 分钟
// ✅ 正确:密码哈希 + 登录限流
import bcrypt from "bcrypt";
import { RateLimiter } from "limiter";
const limiter = new RateLimiter({ tokensPerInterval: 5, interval: "minute" });
async function login(email: string, password: string, ip: string) {
if (!(await limiter.removeTokens(1))) {
throw new Error("登录尝试过多,请 15 分钟后再试");
}
const user = await User.findByEmail(email);
if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
throw new Error("邮箱或密码错误");
}
return generateTokens(user);
}
数据安全
- 敏感数据加密存储(AES-256-GCM)
- 日志中不记录敏感信息(密码、token、个人身份信息)
- API 响应不泄露内部结构(错误堆栈、SQL、路径)
// ✅ 正确:敏感信息脱敏
const sanitizeForLog = (obj: Record<string, unknown>) => {
const sensitive = ["password", "token", "apiKey", "ssn", "creditCard"];
return Object.fromEntries(
Object.entries(obj).map(([k, v]) => [
k,
sensitive.includes(k) ? "[REDACTED]" : v,
])
);
};
logger.info("User login", sanitizeForLog({ email, password, ip }));
// 输出: User login { email: "[email protected]", password: "[REDACTED]", ip: "..." }
安全扫描(2026 新增)
- 每次提交前运行 AI 安全扫描(Claude Code Security)
- Critical 问题必须修复后才能合并
- 扫描记录写入
security-audit.md - 定期重新扫描历史代码(每月一次)
# 安全扫描命令
claude-code security scan ./src --severity critical,high
# 输出到审计文件
claude-code security scan ./src --report markdown >> security-audit.md
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 186 lines · 1,355 tokens per session scan A bf87188f05cf
security is a cursor rule published in the GitHub repository bestcarly/opc-coding-guide (7 stars, last pushed 5mo ago), licensed MIT. It adds 1,355 tokens to every session, about $0.0068 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
webkit-browser
Cursor rule "webkit-browser" from duckduckgo/apple-browsers, covering webkit & browser development guidelines, webview configuration, basic webview setup, user scripts management and tab management.
cypress-e2e-testing-cursorrules-prompt-file
Cursor rules for Cypress development with E2E testing.
vasu-playwright-utils
../../templates/cursor-rules/vasu-playwright-utils.mdc.
dev-browser
Fallback browser automation with persistent Chrome state. Use only when Browser Use is unavailable or blocked.
node-dependencies
Enforce Node.js versioning and package management best practices.
security-standards
Cursor rule "security-standards" from wjgogogo/cursor-rules, covering 安全规范, 核心原则 [p0], 输入验证, xss 防护 and csrf 防护.