@codacy/tools-flawfinder-2
v0.2.1
Published
Flawfinder adapter — CLI-mode C/C++ security analyzer
Downloads
399
Readme
@codacy/tools-flawfinder-2
Table of Contents
Overview
C/C++ security scanner using the Flawfinder Python script. Uses the CLI execution strategy -- spawns flawfinder via spawnTool() and parses its SARIF JSON output.
| Property | Value |
|----------|-------|
| Tool ID | flawfinder |
| Codacy UUID | 81806a42-1d70-40e6-ad07-9a1a9da9e500 |
| Strategy | CLI |
| Languages | C, CPP |
| Binary | flawfinder (Python script) |
| File patterns | **/*.c, **/*.h, **/*.cpp, **/*.cc, **/*.cxx, **/*.hpp |
| Pattern count | ~222 |
| Prerequisites | Python >= 3.8.0 |
Updating patterns
# Re-fetch pattern metadata from the Codacy API
pnpm prefetch
# Commit the result
git add src/patterns.jsonPattern IDs follow the format flawfinder_strcpy, flawfinder_gets, etc.
Updating the Flawfinder version
- Update
preferredVersioninsrc/adapter.ts - Update the
PIP_PACKAGEconstant version pin insrc/adapter.ts - Run
pnpm prefetchto check for new/removed rules - Run
pnpm testto verify compatibility - If the major version changes, create a new adapter package (
flawfinder-3/)
Development
pnpm build # Build with tsup
pnpm test # Run tests (requires flawfinder in PATH or venv)Installing flawfinder -- the adapter can auto-install via pip install into an isolated venv, or you can install manually:
# Via pip (recommended)
pip install flawfinder==2.0.19
# macOS
brew install flawfinder
# Ubuntu/Debian
apt-get install flawfinderNotes for maintainers
- Flawfinder is a pure Python script with no compiled dependencies beyond the standard library.
- Installation uses an isolated venv at
~/.codacy/runtimes/flawfinder/venv/to avoid polluting the system Python. - The adapter uses
--sariffor SARIF v2.1.0 JSON output and--falsepositiveto exclude likely false positives (matching the legacy Codacy wrapper behavior). - Flawfinder has no configuration file -- all options are CLI flags.
checkLocalConfigurationFilealways returns{ found: false }. - Pattern filtering is done post-hoc since flawfinder has no flag to select individual rules.
- Exit code 0 = success. Exit code 15 = encoding error. Exit code 16 = CLI option error.
- The
--minlevelflag is not set, so flawfinder uses its default minimum level of 1 (matching the legacy wrapper). - SARIF parsing extracts
runs[0].results[]. Each result'sruleIdis the function name (e.g. "strcpy", "gets"). - The version regex handles both
Flawfinder version 2.0.19and variations in output format.
