Use when reviewing Rails code for security risks, assessing authentication or authorization, auditing parameter handling, redirects, file uploads, secrets management, or checking for XSS, CSRF, SSRF, SQL injection, and other common vulnerabilities.
85
80%
Does it follow best practices?
Impact
91%
1.49xAverage score across 3 eval scenarios
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./rails-security-review/SKILL.mdUse this skill when the task is to review or harden Rails code from a security perspective.
Core principle: Prioritize exploitable issues over style. Assume any untrusted input can be abused.
| Area | Key Checks |
|---|---|
| Auth | Permissions on every sensitive action |
| Params | No permit!, whitelist only safe attributes |
| Queries | Parameterized — no string interpolation in SQL |
| Redirects | Constrained to relative paths or allowlist |
| Output | No html_safe/raw on user content |
| Secrets | Encrypted credentials, never in code or logs |
| Files | Validate filename, content type, destination |
High-severity (unscoped redirect):
# Bad: user-controlled redirect
redirect_to params[:return_to]return_to=https://evil.com to redirect victims. Mitigation: Redirect only to relative paths or an allowlist.Medium-severity (mass assignment):
# Bad: permit too much
params.require(:user).permit!permit! allows privilege escalation. Mitigation: Permit only safe attributes; never permit role, admin, or other privilege fields from request params.| Mistake | Reality |
|---|---|
| "Only internal users access this" | Internal tools get compromised. Apply same security standards. |
permit! "just for now" | It will ship. Whitelist attributes from day one. |
| "Rails handles CSRF automatically" | Only if protect_from_forgery is active and tokens are verified. |
| String interpolation in SQL | SQL injection. Always use parameterized queries. |
html_safe on user content | XSS. Only use on developer-controlled strings. |
| Secrets in environment files committed to git | Use encrypted credentials. Rotate compromised secrets immediately. |
permit! anywhere in production codewhere(), find_by_sql(), or execute()redirect_to params[:url] without validationhtml_safe or raw called on user-provided data.env, secrets.yml)Write findings first.
For each finding include:
| Skill | When to chain |
|---|---|
| rails-code-review | For full code review including non-security concerns |
| rails-architecture-review | When security issues stem from architectural problems |
| rails-migration-safety | When reviewing migration security (data exposure, constraints) |
ae8ea63
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.