@codacy/tools-brakeman-4
v0.2.1
Published
Brakeman adapter — CLI-mode Ruby on Rails security scanner
Readme
@codacy/tools-brakeman-4
Table of Contents
Overview
Ruby on Rails security scanner using the Brakeman gem. Uses the CLI execution strategy -- spawns brakeman -f json via spawnTool() and parses its JSON output.
| Property | Value |
| ------------- | ----------------------------------------------- |
| Tool ID | Brakeman |
| Codacy UUID | c6273c22-5248-11e5-885d-feff819cdc9f |
| Strategy | CLI |
| Languages | Ruby |
| Binary | brakeman (installed via gem install) |
| File patterns | **/*.rb, **/*.erb, **/*.haml, **/*.slim |
Updating patterns
pnpm prefetch
git add src/patterns.jsonPattern IDs are bare check names (no prefix): SQL, CrossSiteScripting, Execute, etc.
Updating the Brakeman version
- Update
BRAKEMAN_VERSIONinsrc/adapter.ts - Run
pnpm prefetchto check for new/removed checks - Run
pnpm testto verify compatibility - If the major version changes, create a new adapter package (
brakeman-5/)
Development
pnpm build # Build with tsup
pnpm test # Run tests (requires ruby + brakeman in PATH for integration tests)To install brakeman locally for testing:
gem install brakeman -v 4.3.1Notes for maintainers
- Brakeman is Rails-only. The adapter checks for
config/environment.rbbefore running and returns empty results (not an error) for non-Rails projects. - Whole-project scanning: Brakeman cannot target individual files. It scans the entire Rails app via
-p <path>. Results are filtered byctx.targetFilesafter parsing. --no-exit-on-warn --no-exit-on-errorensures Brakeman always produces JSON output.-qsuppresses informational messages so stdout contains only JSON.- Pattern IDs match
check_namefrom Brakeman's JSON output (notwarning_code). - Brakeman's
confidencefield (High/Medium/Weak) is mapped toIssue.confidence(1/2/3). - The
errorsarray in Brakeman's output contains parse errors (files Brakeman couldn't read), mapped toAnalysisErrorwarnings. - Config file detection supports
config/brakeman.ignore(warning suppression file) andconfig/brakeman.yml.
