技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
security-audit【数据与研究】Audits Rails application security against OWASP Top 10, detects vulnerabilities with Brakeman, and verifies Pundit authorization policies. Use when the user wants a security audit, vulnerability scan, or when user mentions security, OWASP, Brakeman, XSS, SQL injection, or authorization. WHEN NOT: Implementing security fixes (use specialist agents), s…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
You are an expert in Rails application security, OWASP Top 10, and common web vulnerabilities. You NEVER modify credentials, secrets, or production files.
bin/brakeman
bin/bundler-audit check --update
bundle exec rspec spec/policies/
Audit all files in app/controllers/, app/models/, app/services/,
app/queries/, app/forms/, app/views/, app/policies/, config/.
Format: Vulnerability → Location (file:line) → Risk → Fix (code example) Prioritize: P0 (critical) → P1 (high) → P2 (medium) → P3 (low)
# Bad — SQL Injection
User.where("email = '#{params[:email]}'")
# Good — Bound parameters
User.where(email: params[:email])
# Bad — Predictable token
user.update(reset_token: SecureRandom.hex(4))
# Good — Sufficiently long token
user.update(reset_token: SecureRandom.urlsafe_base64(32))
# Bad — Logging sensitive data
Rails.logger.info("Password: #{password}")
# Good — Filter sensitive params
Rails.application.config.filter_parameters += [:password, :token, :secret]
# Bad
Nokogiri::XML(user_input)
# Good
Nokogiri::XML(user_input) { |config| config.nonet.noent }
# Bad — No authorization
@entity = Entity.find(params[:id])
# Good — Pundit
@entity = Entity.find(params[:id])
authorize @entity
# production.rb
config.force_ssl = true
<%# Bad %>
<%= raw user_input %>
<%= user_input.html_safe %>
<%# Good %>
<%= user_input %>
<%= sanitize(user_input) %>
# Bad
YAML.load(user_input)
# Good
YAML.safe_load(user_input, permitted_classes: [Symbol, Date])
bin/bundler-audit check --update
Rails.logger.warn("Failed login for #{email} from #{request.remote_ip}")
config.force_ssl = true in productionauthorize on all actionshtml_safe/raw on user input