Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

security-best-practice安全最佳实践

Agent Skill

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

总安装

235

周安装

10

GitHub Stars

22

下载量

82
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:security-best-practice(安全最佳实践)
来源仓库:https://github.com/himself65/auth-spec
仓库路径:skills/security-best-practice
安装命令:
npx skills add https://github.com/himself65/auth-spec --skill security-best-practice
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/himself65/auth-spec --skill security-best-practice

简介

用于安全最佳实践指导与审计。security-best-practice 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

  • 适合检查常见漏洞和认证流程。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。
  • 可生成安全复核清单或风险排查建议。
  • 安装方式:通过 npx 从 GitHub 仓库添加技能。
  • 不能直接使用工具输出作为最终结论。

SKILL.md

Security Best Practice

You are auditing and hardening authentication code against modern (2024-2026) security best practices.

Rules

Individual security rules are in the rules/ directory, organized by impact priority. Read rules/_sections.md for the full taxonomy, and read individual rule files for checklists and fix patterns.

Critical Impact:

  • rules/credential-storage.md — Password hashing (argon2id first), HIBP breach-check, pepper, secret management
  • rules/error-handling.md — User enumeration, timing attacks, status/size symmetry, stack trace leaks

High Impact:

  • rules/session-security.md — Token generation, __Host-/Partitioned cookies, JWT pitfalls, session fixation, rotation on state change
  • rules/input-validation.md — SQL/NoSQL injection, XSS, SSRF, open redirect, schema validation
  • rules/oauth-oidc.md — Code + PKCE, state/nonce, redirect-URI allow-list, account-linking pre-takeover
  • rules/mfa-passkeys.md — TOTP replay prevention, WebAuthn verification, step-up, recovery codes
  • rules/token-lifecycle.md — Password reset, email verification, magic link, OTP hashing & one-time use

Medium Impact:

  • rules/rate-limiting.md — Multi-dim throttling (account + IP), SMS pumping, credential stuffing
  • rules/csrf-protection.md — Origin / Fetch-Metadata, double-submit, SameSite caveats, CORS pitfalls

Lower Priority:

  • rules/http-security-headers.md — HSTS, nonce-CSP, COOP/COEP/CORP, Clear-Site-Data, Trusted Types

Step 1: Detect Project Context

Before starting, scan the user's project to understand their stack:

  1. Framework config files (next.config.*, package.json, go.mod, Cargo.toml, pyproject.toml, build.gradle*, pom.xml)
  2. Existing auth code — route handlers for sign-up, sign-in, session, sign-out, password reset, email verification
  3. Database/ORM setup and session storage (DB table, Redis, JWT)
  4. Existing security measures (rate limiting, CSRF tokens, CSP headers, MFA, OAuth providers)
  5. Whether the app uses cookies, Bearer tokens, or both (determines which rules apply)

Step 2: Choose Audit Scope

Use the AskUserQuestion tool to ask the user what they want to harden. Use multiSelect: true so they can pick multiple areas at once.

Ask "Which security areas do you want to audit and harden?" with header "Security audit scope".

  • Credential storage — "Password hashing (argon2id/bcrypt), breach check, pepper, secret management"
  • Session security — "Token generation, cookie flags, expiry, fixation, JWT pitfalls"
  • Input validation — "SQL/NoSQL injection, XSS, SSRF, open redirect, schema validation"
  • OAuth / OIDC — "Code + PKCE, state/nonce, redirect URIs, account linking pre-takeover"
  • MFA & passkeys — "TOTP, WebAuthn, recovery codes, step-up flows"
  • Short-lived tokens — "Password reset, email verification, magic link, OTP"
  • Rate limiting & brute-force protection — "Multi-dim throttling, SMS pumping, credential stuffing"
  • CSRF protection — "Cross-site request forgery for cookie-based auth"
  • HTTP security headers — "CSP, HSTS, COOP/COEP, Clear-Site-Data"
  • Error handling & information leakage — "Generic errors, no timing/size leaks, no user enumeration"
  • Full audit (all of the above) — "Comprehensive security review"

Step 3: Run the Audit

For each selected area, read the corresponding rule file from rules/ and review the user's code against its checklist. Report findings as:

  • PASS — implementation is correct
  • FAIL — vulnerability or misconfiguration found (include file path, line number, and fix)
  • MISSING — security control is absent (include where to add it and sample code)

After the audit, apply fixes directly to the code. For each fix, explain what was wrong and why the fix is necessary. Link to the relevant rule file for reference.

Step 4: Generate Report

After applying fixes, produce a summary table:

AreaStatusIssues FoundFixed
Credential storagePASS/FAILdescriptionYes/No
Session securityPASS/FAILdescriptionYes/No
OAuth / OIDCPASS/FAILdescriptionYes/No
MFA & passkeysPASS/FAILdescriptionYes/No
Token lifecyclePASS/FAILdescriptionYes/No
............

For any issues that cannot be auto-fixed (e.g., require infrastructure changes like adding Redis for rate limiting, configuring HSTS preload at the edge, registering OAuth redirect URIs with the IdP), list them as manual action items with clear instructions.

Step 5: Verify Fixes

After applying fixes:

  1. If the project has tests, run them to ensure nothing broke
  2. If the project has a linter, run it to verify code style
  3. If the project has a build step, run it to check for compilation errors
  4. If feasible, exercise the auth flows end-to-end (sign-up, sign-in, reset, logout) to confirm behavior

Implementation Rules

  • Never weaken existing security. If the code already uses argon2id, do not downgrade to bcrypt. If cookies already have SameSite=Strict and the __Host- prefix, do not loosen them.
  • Follow the project's existing patterns. If they use middleware for other concerns, add security middleware the same way. Match naming conventions, file structure, and error handling style.
  • Do not add dependencies without asking. If a fix requires a new library (e.g. argon2, helmet, @simplewebauthn/server, hibp), ask the user before adding it.
  • Adapt to the language/framework idioms. Use the canonical approach for each ecosystem (e.g. helmet middleware in Express, SecurityFilterChain in Spring Boot, middleware in Go/Chi).
  • Be conservative with CSP. A too-strict Content-Security-Policy can break the application. Start in report-only mode, collect violations for 1–2 weeks, then enforce.
  • Be conservative with HSTS preload. Removal takes weeks. Only preload once every subdomain serves HTTPS.
  • Respect the auth-spec project rules. All auth code must be hand-written — no auth libraries (better-auth, next-auth, Auth.js, lucia, passport, etc.). Only allowed deps: web framework, ORM, password-hashing lib, WebAuthn verification lib, security-header/CSRF utility libs, and a rate-limit store client (e.g. Redis).

Sources

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.22%
按下载量换算29

Claude

27.09%
按下载量换算22

Cursor

19.85%
按下载量换算16

Gemini CLI

9.01%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills