rails-security
Skill1 starsChanged 7 months agoMITView on GitHub
Use when auditing a Rails app for SQL injection, XSS, CSRF, mass-assignment, or Gemfile.lock CVEs, or when reviewing only NEW security regressions in a PR vs base branch.
- Deletes or force-pushes
3 other projects use a version of this.
Adopted by
Most recently taken up by
- mickzijdel/rails-toolkittheir own version, first seen Sep 24, 2026
- roodlicht/accans-sec-skillstheir own version, first seen May 7, 2026
- FaisalAlqarni/sp-ecctheir own version, first seen Feb 6, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- FaisalAlqarni/sp-ecc★ 9same name
- roodlicht/accans-sec-skills★ 4same name
- mickzijdel/rails-toolkit★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- azure-devopsSkill
- fastlaneSkill
- firebaseSkill
- herokuSkill
- k6Skill
- linearSkill
- maestroSkill
- postgresSkill
- profiles-and-credentialsSkill
- react-nativeSkill
- rspecSkill
- sentrySkill
- shopifySkill
- slackSkill
- trelloSkill
- xlsx-testcasesSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 39
If a tool is missing, the relevant subcommand is skipped with a clear message.
- Distinctive: line 141
ALWAYS require a reason — without it future maintainers can't audit decisions.
- Distinctive: line 161
Never bypass scanners in CI without an approved exception (PR comment + ignore entry with reason).
- Very specific: line 162
Use diff mode for PR review — only see NEW issues, drastically cuts noise.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/rails-security — Brakeman + bundler-audit
Combined Rails security scan. No credentials. Subcommands:
vulns, cves, audit, diff, ignore, update.
Overview
Combined Brakeman (static analysis) + bundler-audit (CVE) scan for Rails apps. diff mode is the killer feature: shows only NEW issues vs base branch via git worktree (non-destructive — never touches your working tree).
When to Use
- Pre-PR security gate (new SQL injection, XSS, CSRF, mass-assignment)
- Auditing
Gemfile.lockfor known CVEs - PR review: only see what THIS PR introduced, not pre-existing noise
- Adding ignored issues with documented reason for audit trail
When NOT to Use
- Non-Rails projects → Brakeman is Rails-specific
- Runtime / dynamic security testing → use OWASP ZAP, not static scanners
- Dependency updates not security-related → use Dependabot / Renovate
- Auditing infrastructure (Docker, k8s) → wrong scope
Dependencies
gem install brakeman bundler-auditIf a tool is missing, the relevant subcommand is skipped with a clear message.
Helpers
brakeman_cmd() {
if [ -f "${1:-.}/Gemfile" ] && grep -q "brakeman" "${1:-.}/Gemfile" 2>/dev/null; then
echo "bundle exec brakeman"
else
echo "brakeman"
fi
}Dispatch
vulns [path] [--severity high|medium|low|all] — Brakeman scan
PATH_ARG="${1:-.}"; SEV="${SEV:-medium}"
mapfile -t CMD < <(brakeman_cmd "$PATH_ARG" | tr ' ' '\n')
"${CMD[@]}" -p "$PATH_ARG" -f json -o /tmp/brakeman.json --no-progress 2>/dev/null
jq -r --arg sev "$SEV" '
.warnings[] | select(
($sev=="all") or
($sev=="high" and .confidence=="High") or
($sev=="medium" and (.confidence=="High" or .confidence=="Medium")) or
($sev=="low" and true))
| "[\(.confidence)] \(.warning_type): \(.message)\n \(.file):\(.line)"
' /tmp/brakeman.json
jq -r '.warnings | group_by(.confidence) | .[] | "\(.[0].confidence): \(length)"' /tmp/brakeman.jsoncves [path] — bundler-audit CVE scan
PROJ="${1:-.}"
[ -f "$PROJ/Gemfile.lock" ] || { echo "No Gemfile.lock" >&2; return 1; }
bundle-audit update --quiet 2>/dev/null || true
(cd "$PROJ" && bundle-audit check --format json) > /tmp/bundler-audit.json 2>/dev/null
jq -r '
.results[]? | "[\(.advisory.criticality // "unknown" | ascii_upcase)] \(.gem.name) \(.gem.version)
CVE: \(.advisory.cve // .advisory.id) Fix: upgrade to \(.advisory.patched_versions | join(", "))
\(.advisory.title)"
' /tmp/bundler-audit.jsonaudit [path] — both + pre-PR gate (exit non-zero on HIGH or any CVE)
"$0" vulns "$1"; echo ""; "$0" cves "$1"
HIGH_BR=$(jq -r '[.warnings[] | select(.confidence=="High")] | length' /tmp/brakeman.json 2>/dev/null || echo 0)
CVES=$(jq -r '(.results // []) | length' /tmp/bundler-audit.json 2>/dev/null || echo 0)
[ "$HIGH_BR" -gt 0 ] || [ "$CVES" -gt 0 ] && {
echo "GATE: $HIGH_BR HIGH Brakeman + $CVES CVEs"
return 1
}diff [base-branch] — only NEW issues vs base (non-destructive)
Uses git worktree add — your working tree is NEVER modified.
BASE="${BASE:-main}"
WT="$(mktemp -d)/rails-security-base"
trap "git worktree remove --force $WT 2>/dev/null; rm -rf $WT" EXIT INT TERM
git worktree add --quiet "$WT" "$BASE" || { echo "Cannot worktree at $BASE" >&2; return 1; }
mapfile -t CMD < <(brakeman_cmd "." | tr ' ' '\n')
(cd "$WT" && "${CMD[@]}" -f json -o /tmp/brakeman-base.json --no-progress 2>/dev/null) || true
"${CMD[@]}" -f json -o /tmp/brakeman-head.json --no-progress 2>/dev/null
echo "=== NEW Brakeman ==="
jq -s '(.[0].warnings|map(.fingerprint)) as $b | .[1].warnings | map(select(.fingerprint as $f | $b | index($f) | not)) | .[] | "[\(.confidence)] \(.warning_type) — \(.file):\(.line)"' /tmp/brakeman-base.json /tmp/brakeman-head.json
(cd "$WT" && bundle-audit check --format json) > /tmp/ba-base.json 2>/dev/null || echo '{}' > /tmp/ba-base.json
bundle-audit check --format json > /tmp/ba-head.json 2>/dev/null || echo '{}' > /tmp/ba-head.json
echo ""; echo "=== NEW CVEs ==="
jq -s '(.[0].results//[]|map(.advisory.id)) as $b | (.[1].results//[]) | map(select(.advisory.id as $id | $b | index($id) | not)) | .[] | "\(.gem.name) \(.gem.version) — \(.advisory.cve // .advisory.id)"' /tmp/ba-base.json /tmp/ba-head.jsonWhy worktree, not stash: stash is destructive on Ctrl-C/OOM, swallows merge conflicts. Worktree creates isolated checkout in temp dir.
ignore brakeman <fingerprint> [note] / ignore cve <CVE-ID> [note]
# Brakeman:
mkdir -p config; [ -f config/brakeman.ignore ] || echo '{"ignored_warnings":[]}' > config/brakeman.ignore
jq --arg fp "$FP" --arg note "${NOTE:-no reason given}" \
'.ignored_warnings += [{fingerprint:$fp, note:$note}]' config/brakeman.ignore > config/brakeman.ignore.tmp \
&& mv config/brakeman.ignore.tmp config/brakeman.ignore
# CVE:
[ -f .bundler-audit.yml ] || echo "ignore: []" > .bundler-audit.yml
echo "Edit .bundler-audit.yml to add: $CVE_ID # ${NOTE:-add reason}"ALWAYS require a reason — without it future maintainers can't audit decisions.
update — refresh advisory DB
bundle-audit update # hits GitHub; fallback: bundle-audit check --no-updateCommon Mistakes
- Ignoring without a reason → future maintainers can't audit decisions
- Running scanner on full codebase every PR → use
diffmode for noise reduction - Stash-based diff instead of worktree → destructive on Ctrl-C / OOM
- Skipping
bundle-audit update→ stale CVE database misses recent vulns - Brakeman ignore by line number → use fingerprint (survives refactors)
- Treating Brakeman
Lowas noise → some are real, just rare paths
Safety
- Scan output reveals attack surface (file paths, gem versions). Don't paste raw output publicly.
brakeman.ignoreand.bundler-audit.ymlMUST be committed (audit trail of accepted-risk decisions).- Never bypass scanners in CI without an approved exception (PR comment + ignore entry with reason).
- Use
diffmode for PR review — only see NEW issues, drastically cuts noise.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

