Workbench · Bench 04 · Code security
What a careful read of a codebase turns up.
Dependencies, lint, code smells and leaked secrets, checked in one pass and written up as a plain report you can act on. Notes from reading code with a suspicious eye.
See the four checks- Critical
minimist 1.2.5CVE-2021-44906 · upgrade to 1.2.6 - Critical
.env.backupAWS access key in git history - High
lodash 4.17.15CVE-2021-23337 · upgrade to 4.17.21 - Medium
orders.ts:88Floating promise, errors swallowed - Smell
handlePayment()212 lines, complexity 31
Four things a security read looks at.
The same ground a tool like SonarQube covers, and worth a human read as well as a scan.
01
Dependencies and CVEs
Every package in your lockfile matched against the public vulnerability databases, with the version that fixes it.
Highlodash 4.17.15CVE-2021-23337 · fixed in 4.17.2102
Lint and conventions
Your own linter config run as the team intended, plus the rules that catch real bugs: unused results, unsafe any, floating promises.
Mediumsrc/api/orders.ts:88Promise returned is not awaited03
Code smells
Long functions, deep nesting, copy-pasted blocks and files everyone is scared to touch, ranked by how often they change.
Smellcheckout.ts · handlePayment()212 lines · complexity 3104
Secrets and config
Keys and tokens in the code or the git history, debug flags left on, and permissions wider than they need to be.
Critical.env.backup (commit 4e1a9c2)AWS access key in history
A scanner gives you four hundred warnings. What helps is a short ranked list, and fixing the worst three first.
How a review usually runs.
Scan for breadth, read what it flags, and rank what is left.
1
Run the scanners
Dependency, lint and secret scanners over the whole repository, for breadth.
2
Read what they flag
Open the flagged code, check it is real, and drop the noise.
3
Rank the findings
A short list with the fix for each finding, worst first.