AI Skills AI技能 16h ago Updated 12h ago 更新于 12小时前 46

Your AI Writes the Code. Who's Checking It for Security? Meet ai-Security-Skill 你的AI编写代码,谁在检查它的安全性?认识ai-Security-Skill

ai-security-skill is a local-first security control plane designed to integrate deterministic code analysis directly into AI-assisted development workflows, addressing the "marking your own homework" problem where AI agents verify their own code The system combines a Knowledge Layer (OWASP ASVS V5, OWASP API Security Top 10, OWASP Top 10 for GenAI/LLMs, NIST SSDF, CIS Controls) with a Verification Layer using TypeScript AST parsing, static analysis, and taint-flow detection Context-aware securit 提出 ai-security-skill 本地优先安全控制面,解决 AI 编码助手“自己检查自己代码”的信任问题 采用确定性静态分析(TypeScript AST + Taint Flow)替代 LLM 主观判断,实现精准漏洞追踪 支持项目上下文感知,自动识别技术栈并映射 OWASP/NIST/CIS 等安全标准进行针对性检查 内置 AIAgentAnalyzer 专门检测 AI Agent 工具调用中的授权缺失风险 通过 MCP 协议集成到 Cursor/Claude Code 等开发环境,实现生成-验证闭环

68
Hot 热度
65
Quality 质量
62
Impact 影响力

Analysis 深度分析

TL;DR

  • ai-security-skill is a local-first security control plane designed to integrate deterministic code analysis directly into AI-assisted development workflows, addressing the "marking your own homework" problem where AI agents verify their own code
  • The system combines a Knowledge Layer (OWASP ASVS V5, OWASP API Security Top 10, OWASP Top 10 for GenAI/LLMs, NIST SSDF, CIS Controls) with a Verification Layer using TypeScript AST parsing, static analysis, and taint-flow detection
  • Context-aware security profiling automatically detects project dependencies (frameworks, databases, auth providers, sensitive integrations like Stripe/OpenAI) and activates only relevant security controls rather than running hundreds of irrelevant rules
  • The TaintAnalyzer tracks data flow from untrusted sources (req.body, req.query) through transformations to sensitive sinks (payment APIs, database operations), enabling precise vulnerability detection beyond simple pattern matching
  • MCP integration allows AI coding assistants (Cursor, Claude Code, Windsurf) to query security requirements before implementation and receive immediate feedback, while Architecture Decision Records provide version-controlled exception management

Why It Matters

This addresses a critical gap in the rapidly expanding AI-assisted development ecosystem: as agents generate code at unprecedented speed, traditional security workflows cannot keep pace with the volume and velocity of code creation. The "marking your own homework" problem highlights a fundamental trust deficit that will only worsen as AI agents gain more autonomous capabilities, making independent verification layers essential for enterprise adoption.

Technical Details

  • Architecture: Two-layer system combining a Knowledge Layer (OWASP standards, NIST SSDF, CIS Controls) with a Verification Layer built on TypeScript Compiler API for AST parsing, static analysis, and taint-flow analysis
  • Context Discovery: discoverProject function profiles workspaces by analyzing package.json, dependencies, and imports to identify application stack (Next.js, Express, Fastify), database stack (PostgreSQL, MongoDB, Prisma), authentication systems (Clerk, NextAuth, OAuth), and sensitive integrations (Stripe, OpenAI, LangChain)
  • Taint Flow Analysis: Tracks untrusted data sources (req.body, req.query, req.params, request.json()) through intermediate transformations to sensitive sinks (payment APIs, database operations), flagging entire data flows rather than isolated code points
  • AIAgentAnalyzer: Specifically examines AI agent tool definitions for destructive operations (refund, delete, transfer) and validates authorization controls (auth(), session, userId, role) to prevent prompt injection attacks that could trigger unauthorized actions
  • MCP Integration & ADRs: Exposes security controls as an MCP server for direct IDE integration; uses .security/decisions/ directory with version-controlled Architecture Decision Records that support expiration dates, approval workflows, and reviewer attribution for legitimate exceptions

Industry Insight

  • The shift toward "security at the point of generation" rather than post-hoc scanning represents a fundamental workflow change that will become table stakes as AI coding agents reach mainstream enterprise adoption; organizations should evaluate tools that integrate into existing CI/CD pipelines and IDE environments
  • Context-aware security profiling that reduces false positives by understanding project-specific technology stacks addresses the primary complaint developers have with traditional SAST tools—alert fatigue from hundreds of irrelevant findings—making security teams more likely to act on genuine vulnerabilities
  • The MCP integration pattern demonstrates how security tooling can evolve from passive scanners to active participants in the development loop, enabling pre-emptive security guidance that shapes agent behavior before vulnerable code is written rather than detecting issues after the fact

TL;DR

  • 提出 ai-security-skill 本地优先安全控制面,解决 AI 编码助手“自己检查自己代码”的信任问题
  • 采用确定性静态分析(TypeScript AST + Taint Flow)替代 LLM 主观判断,实现精准漏洞追踪
  • 支持项目上下文感知,自动识别技术栈并映射 OWASP/NIST/CIS 等安全标准进行针对性检查
  • 内置 AIAgentAnalyzer 专门检测 AI Agent 工具调用中的授权缺失风险
  • 通过 MCP 协议集成到 Cursor/Claude Code 等开发环境,实现生成-验证闭环

为什么值得看

本文针对 AI 辅助开发时代的安全痛点,提出了将安全控制左移到代码生成环节的创新方案,对构建可信 AI 工程化工作流具有重要参考价值。其本地优先、确定性验证的设计理念为 AI 安全工具链提供了新的技术路径。

技术解析

  • 架构设计:采用 Knowledge Layer(OWASP ASVS V5、API Top 10、GenAI Top 10、NIST SSDF、CIS Controls)+ Verification Layer(TypeScript AST 解析、静态分析、污点流分析)的双层架构,实现从标准到代码的映射验证。
  • 上下文感知扫描:通过 discoverProject 分析 package.json、依赖和导入,识别应用栈(Next.js/Express 等)、数据库(PostgreSQL/MongoDB 等)、认证方式(Clerk/NextAuth 等)和敏感能力(Stripe/OpenAI 等),动态激活相关控制规则。
  • 污点流分析引擎:追踪数据从不可信源(req.body/query/params)到敏感汇(如 stripe.paymentIntents.create)的完整传播路径,即使经过变量转换也能识别潜在注入风险。
  • AI Agent 工具安全:AIAgentAnalyzer 专门检测 refund/delete/transfer 等敏感操作的 AI 工具,验证是否存在 auth/session/userId/role 等授权检查逻辑。
  • MCP 集成与 ADR 机制:支持作为 MCP Server 接入 Cursor/Claude Code,实现开发前查询安全要求、开发后自动验证的闭环;通过 .security/decisions/ 目录存储架构决策记录,支持带过期时间和审批流程的安全例外管理。

行业启示

  • 安全左移范式升级:AI 编码速度远超传统安全审查能力,必须将安全验证嵌入代码生成环节而非事后扫描,形成"生成-验证-修复"的即时反馈循环。
  • 确定性优先于概率性:在安全关键决策中,基于代码结构的确定性分析比 LLM 主观判断更可靠,LLM 应定位为解释和修复建议角色而非最终裁决者。
  • 本地优先架构价值:源代码不出域的安全控制模式既满足企业合规要求,又避免第三方服务依赖,为 AI 工具链的私有化部署提供可行方案。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Security 安全 Code Generation 代码生成 Agent Agent Programming 编程 Open Source 开源