prevent-web-security-bugs

prevent-web-security-bugs is a skill for Claude Code, Codex from antgroup/adversarial-ai-coding-plugin. It costs 138 tokens per session (958 once invoked), scanned A, original, Apache-2.0.

A coding guide for building safer web back ends, including APIs, database access, file uploads, permissions, and calls to outside services.

In plain words
What is it for?
Use it when creating or changing web endpoints, handling user input, querying data, processing files, checking permissions, or contacting external services.
Why use it?
It helps prevent common security problems before code is written, such as injection, unauthorized access, server-side request forgery, and unsafe file paths.

Skill for Claude CodeCodex

Part of the adversarial-ai-coding plugin — 5 skills, 2 hooks shipped together

Install

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.

agentmods
npx agentmods add skills/antgroup/adversarial-ai-coding-plugin/prevent-web-security-bugs
Any agent
npx skills add antgroup/adversarial-ai-coding-plugin --skill prevent-web-security-bugs
Clone the repo
git clone --depth 1 https://github.com/antgroup/adversarial-ai-coding-plugin

Made for: Claude Code, Codex.

Or install adversarial-ai-coding, the plugin that ships this one along with the rest of its 5 skills, 2 hooks.

Wrote 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.

agentmods badge for prevent-web-security-bugs

README.md
[![agentmods](https://agentmods.dev/badge/skills/antgroup/adversarial-ai-coding-plugin/prevent-web-security-bugs.svg)](https://agentmods.dev/skills/antgroup/adversarial-ai-coding-plugin/prevent-web-security-bugs)
Your own site
<a href="https://agentmods.dev/skills/antgroup/adversarial-ai-coding-plugin/prevent-web-security-bugs"><img src="https://agentmods.dev/badge/skills/antgroup/adversarial-ai-coding-plugin/prevent-web-security-bugs.svg" alt="Measured on agentmods" height="20"></a>
Per session 138 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 958 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00138 $0.00958
Opus 5 $0.00069 $0.00479
Sonnet 5 $0.00028 $0.00192
Haiku 4.5 $0.00014 $0.00096

Measured 4d ago against content hash 8f98f9738706, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

prevent-web-security-bugs 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 4d 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.

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.

plugin/skills/prevent-web-security-bugs/SKILL.md · 62 lines

What it actually says

安全代码生成规范

工作流程

按以下三步执行安全代码生成。安全漏洞的修复成本随开发阶段推进急剧上升——在代码生成阶段消除漏洞成本最低,上线后修复可能需要紧急发布、数据迁移甚至承担安全事故损失。

第一步:识别安全风险

逐条分析用户需求,对照下表判断哪些风险类型适用于当前场景。

风险类型 触发场景 参考文档
Query Language 注入 字符串拼接构造 SQL/HQL/NoSQL 查询 references/prevent-ql-injection.md
越权访问 按资源 ID 查询或修改数据;接口访问控制 references/prevent-unauthorized-access.md
SSRF 服务端发起 HTTP 请求,目标地址来自用户输入 references/prevent-ssrf.md
路径遍历 文件操作,路径由用户输入控制 references/prevent-path-traversal.md
OS 命令执行 执行系统命令,命令内容包含用户输入 references/prevent-os-command-execution.md
代码执行 动态执行脚本或表达式,内容来自用户输入 references/prevent-code-execution.md
模板注入 模板引擎渲染用户可控内容 references/prevent-template-injection.md
反序列化 反序列化用户输入或解析 JSON references/prevent-deserialization.md
凭据硬编码 敏感信息直接硬编码到代码中 references/prevent-hardcoded-credentials.md
XXE XML 解析 references/prevent-xxe.md

第二步:查阅安全编码规范

对第一步中识别出的每个风险类型,读取对应的参考文档,理解漏洞根因、防范模式和安全 API 用法。完成所有文档阅读后再进入第三步。

第三步:生成符合安全规范的代码

在完整理解安全规范后,按以下原则完成用户需求:

  • 默认安全:优先使用参数化查询、白名单校验、安全 API 等内置防护机制
  • 零信任输入:所有来自 HTTP 请求、外部接口、配置文件的数据一律视为不可信,使用前完成格式校验、类型转换或参数化处理
  • 显式鉴权:每个需要权限的操作在当前方法内显式执行权限校验
  • 失败安全:权限校验或输入验证失败时默认拒绝操作并返回明确错误响应

参考资源

参考文档

  • references/prevent-ql-injection.md — SQL/NoSQL 注入防范
  • references/prevent-unauthorized-access.md — 越权访问防范
  • references/prevent-ssrf.md — SSRF 防范
  • references/prevent-path-traversal.md — 路径遍历防范
  • references/prevent-os-command-execution.md — OS 命令执行防范
  • references/prevent-code-execution.md — 代码执行防范
  • references/prevent-template-injection.md — 模板注入防范
  • references/prevent-deserialization.md — 反序列化防范
  • references/prevent-hardcoded-credentials.md — 凭据硬编码防范
  • references/prevent-xxe.md — XXE 防范
Changes

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.

  1. 4d ago First seen · 62 lines · 138 tokens per session scan A 8f98f9738706

Subscribe to this mod's changes

prevent-web-security-bugs is a skill published in the GitHub repository antgroup/adversarial-ai-coding-plugin (7 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 138 tokens to every session and 958 once invoked, about $0.0007 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.

Related

Other skills, from other repositories

create-site

Creates a new Power Pages code site (SPA) using React, Angular, Vue, or Astro. Guides through the full process from initial concept to deployed site: requirements discovery, scaffolding, component planning, design, implementation, validation, and deployment. Use when the user wants to create, build, or scaffold a new…

microsoft/power-platform-skills · 73 tokens

google-ads-audit

Google Ads account audit and business context setup. Run this first — it gathers business information, analyzes account health, and saves context that all other ads skills reuse. Trigger on "audit my ads", "ads audit", "set up my ads", "onboard", "account overview", "how's my account", "ads health check", "what should…

nowork-studio/notfair-plugin · 114 tokens

review

5-pass structured code review — correctness, security, performance, readability, consistency.

SethGammon/Citadel · 17 tokens

alive:system-upgrade

Upgrade ALIVE to the current version. Handles v1/v2/v3.x source states, multi-surface aware (alive-mcp / Hermes / Codex), retroactive version detection, partial-failure resume, dry-run previews, and rollback inspection.

alivecontext/alive · 57 tokens

codex-test-gen

Generate unit tests for specified functions using Codex MCP.

sd0xdev/sd0x-harness · 15 tokens

ensure-pipelines-host

Ensures the tenant has a usable Power Platform Pipelines host environment before any pipeline operation runs. Detects host state via the same resolution order as the Power Apps UI (org-db setting → BAP env metadata → default-custom-host setting); if any existing host (Platform or Custom) is found, uses it. If no host…

microsoft/power-platform-skills · 222 tokens