重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
arch-security-review by duc01226/easyplatform
npx skills add https://github.com/duc01226/easyplatform --skill arch-security-review[IMPORTANT] 在开始前使用
TaskCreate将所有工作分解为小任务——包括每个文件的读取任务。这可以防止因文件过长而丢失上下文。对于简单任务,AI 必须询问用户是否跳过。
先决条件: 执行前必须阅读 .claude/skills/shared/evidence-based-reasoning-protocol.md。
docs/project-reference/domain-entities-reference.md — 领域实体目录、关系、跨服务同步(当任务涉及业务实体/模型时阅读)核心目的: 确保质量——无缺陷、无错误、无遗漏更新、无过时内容。同时验证代码和文档。
目标: 根据 OWASP Top 10 审查代码中的安全漏洞,并强制执行授权、数据保护和安全的编码模式。
工作流程:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
保持怀疑态度。运用批判性思维、顺序性思维。每个主张都需要可追溯的证据和置信度百分比(想法应超过 80%)。
// :x: 易受攻击 - 无授权检查
[HttpGet("{id}")]
public async Task<Employee> Get(string id)
=> await repo.GetByIdAsync(id);
// :white_check_mark: 安全 - 强制执行授权
[HttpGet("{id}")]
[Authorize(Roles.Manager, Roles.Admin)] // 项目授权属性(参见 docs/project-reference/backend-patterns-reference.md)
public async Task<Employee> Get(string id)
{
var employee = await repo.GetByIdAsync(id);
// 验证对此特定资源的访问权限
if (employee.CompanyId != RequestContext.CurrentCompanyId())
throw new UnauthorizedAccessException();
return employee;
}
// :x: 易受攻击 - 存储明文密钥
var apiKey = config["ApiKey"];
await SaveToDatabase(apiKey);
// :white_check_mark: 安全 - 加密敏感数据
var encryptedKey = encryptionService.Encrypt(apiKey);
await SaveToDatabase(encryptedKey);
// 使用安全配置
var apiKey = config.GetValue<string>("ApiKey"); // 来自 Azure Key Vault
// :x: 易受攻击 - SQL 注入
var sql = $"SELECT * FROM Users WHERE Name = '{name}'";
await context.Database.ExecuteSqlRawAsync(sql);
// :white_check_mark: 安全 - 参数化查询
await context.Users.Where(u => u.Name == name).ToListAsync();
// 或者如果需要原始 SQL:
await context.Database.ExecuteSqlRawAsync(
"SELECT * FROM Users WHERE Name = @p0", name);
// :x: 易受攻击 - 无速率限制
[HttpPost("login")]
public async Task<IActionResult> Login(LoginRequest request)
=> await authService.Login(request);
// :white_check_mark: 安全 - 应用速率限制
[HttpPost("login")]
[RateLimit(MaxRequests = 5, WindowSeconds = 60)]
public async Task<IActionResult> Login(LoginRequest request)
=> await authService.Login(request);
// :x: 易受攻击 - 生产环境中的详细错误
app.UseDeveloperExceptionPage(); // 暴露堆栈跟踪
// :white_check_mark: 安全 - 生产环境中的通用错误
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
else
app.UseExceptionHandler("/Error");
# 检查易受攻击的包
dotnet list package --vulnerable
# 更新易受攻击的包
dotnet outdated
// :x: 易受攻击 - 弱密码策略
if (password.Length >= 4) { }
// :white_check_mark: 安全 - 强密码策略
public class PasswordPolicy
{
public bool Validate(string password)
{
return password.Length >= 12
&& password.Any(char.IsUpper)
&& password.Any(char.IsLower)
&& password.Any(char.IsDigit)
&& password.Any(c => !char.IsLetterOrDigit(c));
}
}
// :x: 易受攻击 - 未验证外部数据
var userData = await externalApi.GetUserAsync(id);
await SaveToDatabase(userData);
// :white_check_mark: 安全 - 验证外部数据
var userData = await externalApi.GetUserAsync(id);
var validation = userData.Validate();
if (!validation.IsValid)
throw new ValidationException(validation.Errors);
await SaveToDatabase(userData);
// :x: 易受攻击 - 记录敏感数据
Logger.LogInformation("User login: {Email} {Password}", email, password);
// :white_check_mark: 安全 - 脱敏敏感数据
Logger.LogInformation("User login: {Email}", email);
// 切勿记录密码、令牌或个人身份信息
// :x: 易受攻击 - 用户控制的 URL
var url = request.WebhookUrl;
await httpClient.GetAsync(url); // 可能访问内部服务
// :white_check_mark: 安全 - 验证并限制 URL
if (!IsAllowedUrl(request.WebhookUrl))
throw new SecurityException("Invalid webhook URL");
private bool IsAllowedUrl(string url)
{
var uri = new Uri(url);
return AllowedDomains.Contains(uri.Host)
&& uri.Scheme == "https";
}
⚠️ 必须阅读: CLAUDE.md 了解授权控制器/处理程序模式、RequestContext 用法和实体级访问过滤器(参见 docs/project-reference/backend-patterns-reference.md)。
public class SensitiveDataHandler
{
// 静态加密
public string EncryptForStorage(string plainText)
=> encryptionService.Encrypt(plainText);
// 显示时脱敏
public string MaskEmail(string email)
{
var parts = email.Split('@');
return $"{parts[0][0]}***@{parts[1]}";
}
// 切勿记录敏感数据
public void LogUserAction(User user)
{
Logger.LogInformation("User action: {UserId}", user.Id);
// 不要:Logger.Log("User: {Email} {Phone}", user.Email, user.Phone);
}
}
public async Task<IActionResult> Upload(IFormFile file)
{
// 验证文件类型
var allowedTypes = new[] { ".pdf", ".docx", ".xlsx" };
var extension = Path.GetExtension(file.FileName).ToLowerInvariant();
if (!allowedTypes.Contains(extension))
return BadRequest("Invalid file type");
// 验证文件大小
if (file.Length > 10 * 1024 * 1024) // 10MB
return BadRequest("File too large");
// 扫描恶意软件(如果可用)
if (!await antivirusService.ScanAsync(file))
return BadRequest("File rejected by security scan");
// 生成安全文件名
var safeFileName = $"{Guid.NewGuid()}{extension}";
// 保存到隔离存储
await fileService.SaveAsync(file, safeFileName);
return Ok();
}
# .NET 漏洞扫描
dotnet list package --vulnerable
# 过时的包
dotnet outdated
# 密钥扫描
grep -r "password\|secret\|apikey" --include="*.cs" --include="*.json"
# 硬编码凭据
grep -r "Password=\"" --include="*.cs"
grep -r "connectionString.*password" --include="*.json"
:x: 信任客户端输入
var isAdmin = request.IsAdmin; // 用户提供的!
:x: 暴露内部错误
catch (Exception ex) { return BadRequest(ex.ToString()); }
:x: 硬编码密钥
var apiKey = "sk_live_xxxxx";
:x: 日志记录不足
// 敏感操作无审计跟踪
await DeleteAllUsers();
arch-performance-optimizationarch-cross-service-integrationcode-review重要任务规划说明(必须遵守)
每周安装次数
50
仓库
GitHub 星标数
5
首次出现
2026年1月24日
安全审计
安装于
opencode47
gemini-cli47
codex46
cursor46
claude-code44
github-copilot43
[IMPORTANT] Use
TaskCreateto break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ask user whether to skip.
Prerequisites: MUST READ .claude/skills/shared/evidence-based-reasoning-protocol.md before executing.
docs/project-reference/domain-entities-reference.md — Domain entity catalog, relationships, cross-service sync (read when task involves business entities/models)Critical Purpose: Ensure quality — no flaws, no bugs, no missing updates, no stale content. Verify both code AND documentation.
Goal: Review code for security vulnerabilities against OWASP Top 10 and enforce authorization, data protection, and secure coding patterns.
Workflow:
Key Rules:
Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).
// :x: VULNERABLE - No authorization check
[HttpGet("{id}")]
public async Task<Employee> Get(string id)
=> await repo.GetByIdAsync(id);
// :white_check_mark: SECURE - Authorization enforced
[HttpGet("{id}")]
[Authorize(Roles.Manager, Roles.Admin)] // project authorization attribute (see docs/project-reference/backend-patterns-reference.md)
public async Task<Employee> Get(string id)
{
var employee = await repo.GetByIdAsync(id);
// Verify access to this specific resource
if (employee.CompanyId != RequestContext.CurrentCompanyId())
throw new UnauthorizedAccessException();
return employee;
}
// :x: VULNERABLE - Storing plain text secrets
var apiKey = config["ApiKey"];
await SaveToDatabase(apiKey);
// :white_check_mark: SECURE - Encrypt sensitive data
var encryptedKey = encryptionService.Encrypt(apiKey);
await SaveToDatabase(encryptedKey);
// Use secure configuration
var apiKey = config.GetValue<string>("ApiKey"); // From Azure Key Vault
// :x: VULNERABLE - SQL Injection
var sql = $"SELECT * FROM Users WHERE Name = '{name}'";
await context.Database.ExecuteSqlRawAsync(sql);
// :white_check_mark: SECURE - Parameterized query
await context.Users.Where(u => u.Name == name).ToListAsync();
// Or if raw SQL needed:
await context.Database.ExecuteSqlRawAsync(
"SELECT * FROM Users WHERE Name = @p0", name);
// :x: VULNERABLE - No rate limiting
[HttpPost("login")]
public async Task<IActionResult> Login(LoginRequest request)
=> await authService.Login(request);
// :white_check_mark: SECURE - Rate limiting applied
[HttpPost("login")]
[RateLimit(MaxRequests = 5, WindowSeconds = 60)]
public async Task<IActionResult> Login(LoginRequest request)
=> await authService.Login(request);
// :x: VULNERABLE - Detailed errors in production
app.UseDeveloperExceptionPage(); // Exposes stack traces
// :white_check_mark: SECURE - Generic errors in production
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
else
app.UseExceptionHandler("/Error");
# Check for vulnerable packages
dotnet list package --vulnerable
# Update vulnerable packages
dotnet outdated
// :x: VULNERABLE - Weak password policy
if (password.Length >= 4) { }
// :white_check_mark: SECURE - Strong password policy
public class PasswordPolicy
{
public bool Validate(string password)
{
return password.Length >= 12
&& password.Any(char.IsUpper)
&& password.Any(char.IsLower)
&& password.Any(char.IsDigit)
&& password.Any(c => !char.IsLetterOrDigit(c));
}
}
// :x: VULNERABLE - No validation of external data
var userData = await externalApi.GetUserAsync(id);
await SaveToDatabase(userData);
// :white_check_mark: SECURE - Validate external data
var userData = await externalApi.GetUserAsync(id);
var validation = userData.Validate();
if (!validation.IsValid)
throw new ValidationException(validation.Errors);
await SaveToDatabase(userData);
// :x: VULNERABLE - Logging sensitive data
Logger.LogInformation("User login: {Email} {Password}", email, password);
// :white_check_mark: SECURE - Redact sensitive data
Logger.LogInformation("User login: {Email}", email);
// Never log passwords, tokens, or PII
// :x: VULNERABLE - User-controlled URL
var url = request.WebhookUrl;
await httpClient.GetAsync(url); // Could access internal services
// :white_check_mark: SECURE - Validate and restrict URLs
if (!IsAllowedUrl(request.WebhookUrl))
throw new SecurityException("Invalid webhook URL");
private bool IsAllowedUrl(string url)
{
var uri = new Uri(url);
return AllowedDomains.Contains(uri.Host)
&& uri.Scheme == "https";
}
⚠️ MUST READ: CLAUDE.md for authorization controller/handler patterns, RequestContext usage, and entity-level access filters (see docs/project-reference/backend-patterns-reference.md).
public class SensitiveDataHandler
{
// Encrypt at rest
public string EncryptForStorage(string plainText)
=> encryptionService.Encrypt(plainText);
// Mask for display
public string MaskEmail(string email)
{
var parts = email.Split('@');
return $"{parts[0][0]}***@{parts[1]}";
}
// Never log sensitive data
public void LogUserAction(User user)
{
Logger.LogInformation("User action: {UserId}", user.Id);
// NOT: Logger.Log("User: {Email} {Phone}", user.Email, user.Phone);
}
}
public async Task<IActionResult> Upload(IFormFile file)
{
// Validate file type
var allowedTypes = new[] { ".pdf", ".docx", ".xlsx" };
var extension = Path.GetExtension(file.FileName).ToLowerInvariant();
if (!allowedTypes.Contains(extension))
return BadRequest("Invalid file type");
// Validate file size
if (file.Length > 10 * 1024 * 1024) // 10MB
return BadRequest("File too large");
// Scan for malware (if available)
if (!await antivirusService.ScanAsync(file))
return BadRequest("File rejected by security scan");
// Generate safe filename
var safeFileName = $"{Guid.NewGuid()}{extension}";
// Save to isolated storage
await fileService.SaveAsync(file, safeFileName);
return Ok();
}
# .NET vulnerability scan
dotnet list package --vulnerable
# Outdated packages
dotnet outdated
# Secret scanning
grep -r "password\|secret\|apikey" --include="*.cs" --include="*.json"
# Hardcoded credentials
grep -r "Password=\"" --include="*.cs"
grep -r "connectionString.*password" --include="*.json"
:x: Trusting client input
var isAdmin = request.IsAdmin; // User-supplied!
:x: Exposing internal errors
catch (Exception ex) { return BadRequest(ex.ToString()); }
:x: Hardcoded secrets
var apiKey = "sk_live_xxxxx";
:x: Insufficient logging
// No audit trail for sensitive operations
await DeleteAllUsers();
arch-performance-optimizationarch-cross-service-integrationcode-reviewIMPORTANT Task Planning Notes (MUST FOLLOW)
Weekly Installs
50
Repository
GitHub Stars
5
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode47
gemini-cli47
codex46
cursor46
claude-code44
github-copilot43
Lark Mail CLI 使用指南:邮件管理、安全规则与自动化工作流
46,100 周安装
Playwright MCP 开发指南:如何为微软 Playwright 添加 MCP 工具和 CLI 命令
313 周安装
MCP CLI 脚本开发指南:为Claude Code构建高效本地工具与自动化脚本
313 周安装
OpenAI Assistants API v2 使用指南与迁移方案 - 2026年弃用前必看
313 周安装
Google Chat API 开发指南:Webhook 与交互式机器人集成教程
313 周安装
Fastify OAuth 2.0/2.1 实现与调试指南:授权码+PKCE流程详解
316 周安装
基于文件的待办事项追踪技能 - 代码审查、技术债务与工作项管理
313 周安装