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 skills add Wade-DevCode/awesome-coding-skills-cn --skill input-validationgit clone --depth 1 https://github.com/Wade-DevCode/awesome-coding-skills-cnWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/input-validation)<a href="https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/input-validation"><img src="https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/input-validation/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/input-validation"><img src="https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/input-validation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What 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.1 | $0.00024 | $0.02953 |
| Opus 5.5 | $0.00010 | $0.01181 |
| Sonnet 5.5 | $0.00005 | $0.00591 |
| Haiku 4.5 | $0.00002 | $0.00295 |
Grade A, and why
input-validation scanned grade A with 1 finding 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 1mo ago.
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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
**为什么:** AI 生成全栈应用时,有时只在前端加 `required`、`maxlength`、`pattern` 等 HTML 属性,然后后端直接信任前端送来的数据。任何人用 `curl`、Postman 或浏览器开发者工具都能绕过前端校验,直接发送任意数据到后端。这类漏洞在 AI 代码审查中极为常见,因为 AI 看到前端"已有校验"就不再在后端重复。 How it starts
The opening of the file, as written. The whole thing — 243 lines — stays where its author put it; the contents beside it link to each section on GitHub.
输入校验
何时用
- 编写 API 接口、表单处理、文件上传等接收外部数据的代码时。
- 处理来自消息队列、第三方 Webhook、数据库读回等任何外部数据源时。
- 发现生产环境出现类型错误、字段缺失崩溃、注入攻击等问题时。
- 做安全审查时检查系统边界的防御是否完整。
核心规则
1. 在系统边界集中校验:类型、范围、格式、必填
规则: 在 API 入口(controller/route handler)对所有外部输入做统一校验,覆盖类型是否正确、数值是否在合法范围内、字符串格式是否符合预期、必填字段是否存在;校验通过后的数据才传入业务逻辑层。
为什么: AI 生成 API 接口时最常见的模式是直接把 request.json 传进业务函数,让业务函数自己处理字段缺失或类型错误。这导致两个问题:一是 AttributeError/KeyError 在内层崩溃,堆栈信息可能暴露内部结构;二是相同的校验逻辑散落在各处,维护困难,容易漏掉。AI 还经常只校验"快乐路径",完全忽略 age=-1、quantity=99999999、email=""等边界值。
怎么做:
from pydantic import BaseModel, Field, field_validator
from typing import Literal
class CreateOrderRequest(BaseModel):
product_id: int = Field(gt=0) # ✅ 类型 + 范围
quantity: int = Field(ge=1, le=100) # ✅ 1~100 之间
email: str = Field(pattern=r'^[\w.+-]+@[\w-]+\.[a-z]{2,}$') # ✅ 格式
channel: Literal["web", "app", "api"] # ✅ 枚举白名单
@app.post("/orders")
def create_order(body: CreateOrderRequest): # ✅ 入口即校验
return order_service.create(body) # 业务层拿到的已是合法数据
- 使用 Pydantic(Python)、Zod(TypeScript)、Joi(Node.js)等成熟校验库,不手写正则堆砌。
2. 白名单优先于黑名单;枚举/路径/文件名严格限定
规则: 对枚举值用白名单(只接受已知合法值),不用黑名单(拒绝已知危险值);文件名和路径做规范化后校验,防止路径穿越(../../../etc/passwd);用户可控的文件名只允许 [a-zA-Z0-9._-]。
为什么: AI 实现文件操作时惯用黑名单:if ".." in filename: reject。这类黑名单极容易被绕过——URL 编码 %2e%2e、双重编码 %252e%252e、Unicode 等价字符都能轻易规避。路径穿越漏洞至今仍是 OWASP Top 10 常见漏洞之一,很大程度上因为开发者(包括 AI)低估了绕过黑名单的攻击面。
怎么做:
import os
import re
ALLOWED_EXTENSIONS = {".jpg", ".jpeg", ".png", ".pdf"}
UPLOAD_BASE = "/var/uploads"
def safe_filename(user_filename: str) -> str:
# ✅ 白名单字符集:只保留安全字符
name = re.sub(r'[^a-zA-Z0-9._-]', '_', os.path.basename(user_filename))
ext = os.path.splitext(name)[1].lower()
# ✅ 扩展名白名单
if ext not in ALLOWED_EXTENSIONS:
raise ValueError(f"不支持的文件类型: {ext}")
return name
def safe_path(base_dir: str, user_path: str) -> str:
# ✅ 规范化后确认仍在 base_dir 内,防路径穿越
full = os.path.realpath(os.path.join(base_dir, user_path))
if not full.startswith(os.path.realpath(base_dir) + os.sep):
raise ValueError("路径穿越攻击")
return full
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.
- 1mo ago First seen · 243 lines · 24 tokens per session scan A 1dad929cb32f
input-validation is a skill published in the GitHub repository Wade-DevCode/awesome-coding-skills-cn (7 stars, last pushed 4mo ago), licensed MIT. It adds 24 tokens to every session and 2,953 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
brainstorming
A brainstorming workflow for turning an idea into an agreed design before implementation. It requires exploring the project, asking clarifying questions, comparing options, documenting the design, and getting user approval.
executing-plans
A procedure for carrying out a written software implementation plan in a separate session, including reviewing the plan, completing its tasks, and checking the results at defined review points.
chinese-git-workflow
A reference for configuring Git with Chinese code-hosting services such as Gitee, Coding.net, GitLab China, and CNB, including SSH, HTTPS, credentials, CI, and repository mirroring.
chinese-documentation
A Chinese technical-documentation style guide covering spacing, punctuation, numbers, terminology, and links when Chinese and English appear together.
chinese-code-review
A Chinese-language code-review communication guide with templates and severity levels for review comments.
chinese-commit-conventions
A Chinese-language guide to Conventional Commits, a format for writing consistent Git commit messages, plus related changelog, commit-checking, and commit-helper configuration.