How I score the health of a Node.js API in one command
Описание и применение
Одной командой оценивается безопасность Node.js API, выявляя отсутствующие проверки доступа и отслеживая поток данных до критических точек, с объяснимым баллом.
Задача
Code review catches logic bugs, but nobody reads every controller to check for a missing auth guard. Nobody traces every req.body to see whether it reaches a SQL string either.
Результат
The tool provides a single-command health score, identifies missing auth guards, tracks taint flow to critical sinks, and offers an explainable score breakdown, improving security review efficiency.
Рабочий процесс
- Run npx @sabahattink/codediag scan . to index files once, respecting .gitignore and skipping large/minified files.
- Parse files with ts-morph to build an AST shared by all analyzers.
- Track taint from request data through up to three assignments into shell, SQL, and eval sinks.
- Generate an explainable score where each lost point maps to a rule ID.
- Integrate into CI using the GitHub Action sabahattink/codediag@v0 with threshold and baseline settings.
Доказательства
Code review catches logic bugs, but nobody reads every controller to check for a missing auth guard. Nobody traces every req.body to see whether it reaches a SQL string either.
npx @sabahattink/codediag scan .
Discovery once. Files are indexed a single time, .gitignore-aware, with minified and oversized files skipped.
AST, not regex. ts-morph parses each file once, and all analyzers share the result.
Taint tracking. Request data is followed through up to three assignments into shell, SQL, and eval sinks.
Explainable score. Every lost point maps to a rule ID in the score breakdown.
- uses: sabahattink/codediag@v0
with:
threshold: 80
baseline: .codediag-baseline.json
Path traversal, SSRF, and XSS rules are on the roadmap. Feedback on false positives is the most valuable contribution right now.
- Дата записи: 2026-10-04T21:56:09.950Z