---
name: "brakeman-rails-security-scanner"
description: "Detect SQL injection, XSS, and mass assignment vulnerabilities in Ruby on Rails."
metadata:
  author: "Brakeman"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "run brakeman rails scan"
  - "fix rails sql injection"
  - "audit rails params mass assignment"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Brakeman Ruby on Rails Security Scanner

Performs automated security analysis for Rails using Brakeman: analyzing data flows, controller actions, ActiveRecord queries, CSRF protections, and session tampering vulnerabilities.

## When to Invoke
Invoke this skill whenever you need to:
- run brakeman rails scan
- fix rails sql injection
- audit rails params mass assignment

## Execution SOP & Rules
1. Run brakeman -q -w2 --no-pager to report medium and high severity vulnerabilities.
2. Ensure strong parameters (params.require(...).permit(...)) are strictly enforced on all controller actions.
3. Use parameterized queries (User.where('email = ?', email)) instead of string concatenation.
4. Verify protect_from_forgery is enabled on ApplicationController.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
