Skip to content
Brakeman

Brakeman

Category: SAST
License: Free (Non-Commercial)
Suphi Cankurt
Suphi Cankurt
+7 Years in AppSec
Updated April 30, 2026
6 min read
Key Takeaways
  • Purpose-built SAST for Ruby on Rails (2.3.x through 8.x) with 7,200+ GitHub stars and 54,100+ projects depending on it — used by GitHub, Groupon, and New Relic.
  • Detects 33 vulnerability types including SQLi, XSS, CSRF, command injection, and unsafe deserialization with zero configuration — no running server or database needed.
  • Free for non-commercial use under Brakeman Public Use License; commercial use requires a Synopsys license. Outputs in 11 formats including SARIF and JSON.
  • Rails-aware analysis understands framework conventions like strong parameters, CSRF tokens, and view helpers — distinguishes dangerous html_safe on user input from safe usage.

Brakeman is a SAST tool built for Ruby on Rails applications, free for non-commercial use under the Brakeman Public Use License. It scans Rails source code for 33 types of security vulnerabilities without ever running the application.

Brakeman text report showing security scan results with confidence levels and warning categories

With 7,200+ GitHub stars, 154 contributors, and 54,100+ projects depending on it, Brakeman is the standard security scanner for the Rails ecosystem.

OWASP lists Brakeman among its recommended Source Code Analysis Tools for Ruby on Rails. Organizations using it include Code Climate, GitHub, Groupon, New Relic, and Twitter. The latest release is v8.0.2 (February 2026).

What is Brakeman?

Brakeman performs static analysis on Ruby on Rails source code. You point it at a Rails app directory and it parses models, controllers, views, routes, and configuration files looking for security issues.

It doesn’t need a running server or database, and you don’t have to install application dependencies first.

It understands Rails conventions, so it can trace data from params through controllers into views and detect when user input reaches a dangerous method without sanitization.

33 Warning Types
Covers SQL injection, XSS, command injection, CSRF, mass assignment, path traversal, unsafe deserialization, remote code execution, and 25 more Rails-specific security checks.
Zero Configuration
Run brakeman in your Rails app directory and get results. No config files, no setup, no dependencies beyond the gem itself. Supports Rails 2.3.x through 8.x.
11 Output Formats
Text, HTML, JSON, SARIF, JUnit, Markdown, CSV, tabs, CodeClimate, GitHub, and Sonar. Generate multiple reports from a single scan with -o report.html -o report.json.

Key Features

Security checks

Brakeman detects 33 categories of security vulnerabilities, all specific to Rails patterns:

CategoryChecks
InjectionSQL injection, command injection, remote code execution, dangerous eval, YAML deserialization
Cross-site scriptingStandard XSS, content_tag XSS, JSON response XSS
Access controlCSRF protection gaps, mass assignment, unscoped finds, unsafe redirects
CryptographySSL verification bypass, weak hashing algorithms
Data exposureInformation disclosure, path traversal, file access issues
ConfigurationDefault routes, session settings, basic authentication weaknesses
DependenciesUnmaintained gems with known vulnerabilities

How the engine works

Brakeman performs taint analysis on proprietary code: it tracks user-supplied input from params, headers, and cookies through controllers, models, and views, and flags every dangerous sink it reaches. Because the analyzer follows controller-to-model-to-view paths, it does cross-file dataflow in source code rather than the single-file pattern matching that simpler linters use.

On top of dataflow, Brakeman runs rule-based pattern matching for CWEs across its 33 check categories — SQL injection (CWE-89), XSS (CWE-79), command injection (CWE-77), unsafe deserialization (CWE-502), CSRF gaps (CWE-352), and more — using deterministic Rails-aware rules rather than AI-powered code security analysis. That trade-off keeps scans fast and reproducible at the cost of the contextual triage modern AI-assisted scanners provide.

Note: Brakeman understands Rails routing, strong parameters, CSRF tokens, and view helpers. It knows the difference between html_safe on user input (dangerous) and html_safe on a string literal (fine). Generic SAST tools without Rails awareness miss this context.

Brakeman scan output showing a high-confidence SQL injection and two medium-confidence warnings with file locations and line numbers

Confidence levels

Every finding gets a confidence rating:

  • High — user input flows directly to a dangerous method
  • Medium — a variable reaches a dangerous method but the input source is unclear
  • Weak — indirect connection to user input

Filter by confidence on the command line: brakeman -w3 shows only high-confidence results, -w2 adds medium, -w1 shows everything.

False positive management

Brakeman ships an interactive ignore wizard:

brakeman -I

This walks through each warning and lets you mark false positives. Your decisions save to config/brakeman.ignore.

On later scans, Brakeman automatically reads this file. Use brakeman --show-ignored to review ignored warnings without affecting the exit code.

Scan comparison

Compare two scan results to see what changed between builds:

# Generate a baseline
brakeman -o baseline.json

# Later, compare against it
brakeman --compare baseline.json

This shows new warnings, fixed warnings, and unchanged ones. Useful in CI to only flag issues introduced by a pull request.

Getting Started

1
Install Brakeman — Run gem install brakeman, or add gem "brakeman" to your Gemfile’s development group, or pull the Docker image with docker pull presidentbeef/brakeman.
2
Run your first scan — From your Rails app root, run brakeman. No arguments needed. For Docker: docker run -v "$(pwd)":/code presidentbeef/brakeman --color.
3
Review findings — Start with high-confidence warnings (brakeman -w3). Each warning includes the file, line number, code snippet, and a link to documentation explaining the issue.
4

Set up CI — Add Brakeman to your GitHub Actions workflow or Jenkins pipeline. Brakeman returns a non-zero exit code when warnings are found by default.

Use --compare with a baseline JSON to only flag new findings.

Quick Docker scan

docker run -v "$(pwd)":/code presidentbeef/brakeman --color

Bundler setup

group :development do
  gem "brakeman", require: false
end

Then run with bundle exec brakeman.

How to use Brakeman

A typical Brakeman workflow has four pieces. First, invoke the scan from your Rails app root with brakeman — no arguments are needed. For a stricter pipeline, use confidence filters: brakeman -w3 shows high-confidence findings only, -w2 adds medium, and -w1 returns everything including weak signals.

Second, generate a report in the format your downstream tooling expects: brakeman -o report.html for human review, -o report.json for CI parsing, or -o report.sarif for GitHub code scanning. Third, manage false positives with brakeman -I, which walks through each warning interactively and writes decisions to config/brakeman.ignore — that file is read automatically on subsequent scans.

Fourth, wire Brakeman into your pipeline. The CLI returns a non-zero exit code when warnings are found, so dropping it into a pre-commit hook or a GitHub Actions step is enough to fail builds on Rails-specific security regressions.

Brakeman pricing and licensing

Brakeman is free for non-commercial use under the Brakeman Public Use License. There is no paid SaaS tier, no per-developer rate card, and no contact-sales motion: you gem install brakeman and run scans locally or in CI without registering an account.

Commercial use requires a separate license through Synopsys (now part of Black Duck), which inherited the commercial rights when Brakeman Pro was discontinued in 2018. The open-source CLI continues to receive active updates from the upstream maintainer at github.com/presidentbeef/brakeman — the latest release is v8.0.2 (February 2026), supporting Rails 2.3.x through 8.x.

When to Use Brakeman

Brakeman is purpose-built for Rails. If your app runs on Rails 2.3 through 8.x, it’s the most obvious choice for framework-aware security scanning.

Good use cases:

  • Rails applications of any size, from side projects to large monoliths
  • Pre-commit or CI checks that need to run fast without a database or server
  • Adding Rails-specific depth alongside multi-language tools like Semgrep or SonarQube
  • Teams that want to start with zero configuration and gradually tune with ignore files

Pro tip: Ruby on Rails teams that want a free, zero-config security scanner with deep framework awareness.

Brakeman only analyzes Ruby on Rails code. If your project uses other frameworks (Sinatra, Hanami) or other languages, you’ll need a separate tool for those parts.

It also does static analysis only, so it won’t catch vulnerabilities that only appear at runtime. For runtime coverage, pair it with an IAST or DAST tool.

Brakeman alternatives

Brakeman is purpose-built for Rails, but a few SAST tools are worth considering when you outgrow it or need broader language coverage:

  • Semgrep — rule-driven SAST with a public Rails ruleset; preferred when you also need to scan JavaScript, Python, or Go in the same monorepo and want custom queries without forking a Ruby parser.
  • GitHub CodeQL — query-based SAST bundled with GitHub Advanced Security; a fit when the codebase already lives on GitHub and you want a single vendor for code scanning across all languages.
  • Snyk Code — developer-first SAST built on Snyk’s symbolic-AI engine; chosen when Snyk’s SCA, container, and IaC products are already in use and you want unified triage.
  • Dawnscanner — older Ruby-focused static analyzer with broader framework support (Sinatra, Padrino, Hanami); fits when your stack mixes Rails with non-Rails Ruby apps.

For a wider feature comparison, the SAST tools hub lists every active static analyzer I track.

Note: Used by Code Climate, GitHub, Groupon, New Relic, and Twitter. 54,100+ projects on GitHub depend on it.

Frequently Asked Questions

What is Brakeman?
Brakeman is a static analysis tool built specifically for Ruby on Rails applications, free for non-commercial use under the Brakeman Public Use License (commercial use requires a Synopsys license). It checks for 33 types of security vulnerabilities including SQL injection, XSS, CSRF, command injection, and unsafe deserialization. It supports Rails 2.3.x through 8.x.
Does Brakeman require running the application?
No. Brakeman performs static analysis only, so it never executes your code. It parses the Rails application source and analyzes it for security issues. This means you can scan without a database, running server, or any dependencies installed.
What output formats does Brakeman support?
Brakeman supports 11 output formats: text, HTML, JSON, JUnit XML, Markdown, CSV, tabs, CodeClimate, GitHub, SARIF, and Sonar. JSON is recommended for CI/CD automation and SARIF for GitHub code scanning integration.
How does Brakeman handle false positives?
Brakeman includes an interactive ignore wizard (brakeman -I) that walks you through each warning so you can mark false positives. Decisions are saved to a brakeman.ignore file that persists across scans. You can also filter results by confidence level using -w1, -w2, or -w3.
Can Brakeman run in CI/CD?
Yes. Brakeman works with GitHub Actions, Jenkins (via plugin), and any CI system that can run Ruby or Docker. It returns a non-zero exit code when warnings are found, so you can fail builds on security issues.