Ashrafiucse rails security

From jiayaoqijia/cryptoskill · View interactive version

Ashrafiucse rails security is an AI agent skill from the GitHub repository jiayaoqijia/cryptoskill. Audits Ruby on Rails applications for framework-specific vulnerabilities — SQL injection via interpolated where/order/find_by_sql, mass assignment through params.permit!, XSS via raw/html_safe/<%==, CSRF skips (protect_from_forgery absent, skip_before_action), missing authenticate/authorize before_a

How to use this skill

Skill file

Rails Security

Step 0 — Detect

rg -n "^\s*gem ['\"]rails" -g 'Gemfile'
ls app/controllers config 2>/dev/null

Record Rails version (Gemfile.lock), auth stack (Devise/etc.), deployment hints.

Step 1 — SQL injection

rg -n "where\([\"'].*#\{|order\(params|find_by_sql|group\(params|pluck\(params|select\(params" app/

Step 2 — Mass assignment

rg -n "permit!|params\[:user\]$|\.update_attributes" app/

Step 3 — XSS

rg -n "<%=\s*raw\b|\.html_safe|<%==" app/ app/views/

Census, don't sample: disposition every hit. Severity by privilege direction per ../injection-flaws/SKILL.md (XSS table) — raw @user.bio where the bio is student-authored and the view is staff-facing = Critical.

Step 4 — CSRF & authz

rg -n "protect_from_forgery" app/controllers/application_controller.rb
rg -n "skip_before_action :verify_authenticity|skip_forgery_protection" app/
rg -n "before_action :authenticate|before_action :authorize" app/controllers/ | head

Step 5 — Files, redirects, dispatch

rg -n "send_file|File\.read|IO\.foreach|File\.open" app/
rg -n "redirect_to\s+(params|request\.referer)" app/
rg -n "\bsend\(|public_send\(" app/ | rg "params" | head

Step 6 — Deserialization & config

rg -n "Marshal\.load|Oj\.load|YAML\.load\(" app/ config/
rg -n "secret_key_base" config/ -g '!*.lock' | head
rg -n "force_ssl" config/environments/

Reporting

Severity table above; fixes are idiomatic one-liners (where(hash:), permit lists, redirect_to allowlist). Note strong-params/ORM positives. Dependency CVEs via ../dependency-vulns/SKILL.md.

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.