Thanks for helping. Ground rules first — they exist so the tool stays trustworthy.
- Offline only. No network calls, telemetry, or phone-home of any kind in the scanners, core, reporters, or fix generator. The GitHub Action is the only component allowed to use the network, and only through
@actions/github. - Four frameworks in v1. Express, FastAPI, Next.js, Supabase Edge Functions. Do not add a fifth without an open issue and maintainer sign-off.
- Zero-config by default. Detection should work against a plain clone of a repo. Nothing the user has to set up to get a useful scan.
git clone <repo>
cd rateguard
npm install
npm run build
npm test
npm run coveragesrc/
cli.ts — commander wiring, exit-code policy
core/
scan.ts — walks the dir, dispatches to scanners, classifies
classify.ts — severity heuristics
protection.ts — shared "is this protected?" helpers
scandir.ts — file discovery (.gitignore-aware)
fixGenerator.ts — per-framework fix snippets
diffWriter.ts — unified diff + atomic write + backup
scanners/
express.ts fastapi.ts nextjs.ts supabase.ts
reporters/
table.ts json.ts
action/ — GitHub Action (built with @vercel/ncc)
test/
fixtures/ — vulnerable/protected sample projects
*.test.ts — vitest units + CLI integration
- Write a failing test in
test/scanners.test.tswith an inline fixture. - Implement in the relevant scanner. Prefer AST over regex; add a regex fallback for unparseable files.
- If the heuristic is shared across frameworks, put the helper in
src/core/protection.tsand import it.
- TypeScript, strict, ESM-free runtime (CJS build for the CLI & ncc).
- Keep scanners pure:
scan*(file, src)in,Route[]out. No I/O beyond what's passed in.
- One logical change per PR.
- Tests green:
npm test. - Coverage:
npm run coverage—src/coreandsrc/scannersmust stay ≥ 80%. - Action build passes:
npm run build:action.
By contributing you agree your work is released under the MIT license.