Code review ruby

From NoorQureshi/security-skills · View interactive version

Code review ruby is an AI agent skill from the GitHub repository NoorQureshi/security-skills. Security review of Ruby code — dangerous sinks and Rails pitfalls. Load when reviewing a Ruby/Rails codebase/PR, on .rb source in scope, or "review this Rails app". Signals: Gemfile, config/routes.rb, ActiveRecord, ERB, YAML.load, send/constantize.

How to use this skill

Skill file

Ruby / Rails source review

When it applies

Reviewing Ruby source, usually Rails. Rails is safe by default in many places, so the bugs cluster

in dynamic dispatch, mass assignment gaps, raw SQL, and unsafe deserialization/rendering.

Why it works

Ruby's metaprogramming (send, constantize, eval) turns strings into method/class/code

references, and Rails helpers have unsafe escape hatches (.html_safe, where("...#{x}..."),

render inline:). Tracing params to these is the whole game — and Brakeman automates the first pass.

Sinks & patterns (grep, then trace to user input)

safe_constantize on input (arbitrary class instantiation).

pluck/group with input.

open/Net::HTTP on user URLs, send_file/params[:path] traversal.

Framework specifics

redirect_to params[...] (open redirect), route globbing exposing actions, secrets in

credentials/ENV, default protect_from_forgery disabled on APIs.

Method

  1. Run brakeman and bundler-audit; triage the warnings (Brakeman is high-signal for Rails).
  2. rg 'send\(|constantize|eval|where\(".*#\{|html_safe|YAML.load|render.*inline' → trace to params.
  3. Check every controller's strong-params and before_action auth coverage.
  4. Confirm exploitable findings with web-sqli, web-deserialization, web-ssrf, web-idor.

Gotchas

References

Brakeman docs; Rails Security Guide; OWASP Ruby on Rails cheat sheet.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.