codevet-cli 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/codevet/SKILL.md +8 -0
- package/.cursor/skills/codevet/SKILL.md +8 -0
- package/.opencode/skills/codevet/SKILL.md +8 -0
- package/AGENTS.md +70 -0
- package/CLAUDE.md +2 -0
- package/CODE_OF_CONDUCT.md +31 -0
- package/CONTRIBUTING.md +130 -0
- package/INFO.md +143 -0
- package/PRIVACY.md +71 -0
- package/README.md +1 -1
- package/SECURITY.md +41 -0
- package/TERMS.md +56 -0
- package/dist/scanners/ensureBinary.js +47 -1
- package/docs/ABOUT.md +55 -0
- package/docs/HELP.md +173 -0
- package/docs/SECURITY-CHECKLIST.md +94 -0
- package/package.json +14 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codevet
|
|
3
|
+
description: Vet a project for security issues (leaked secrets, vulnerable dependencies, missing middleware, personal data flow) before committing, deploying, or trusting a cloned repo.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
See [`AGENTS.md`](../../../AGENTS.md) at the repo root for full instructions —
|
|
7
|
+
this file exists only so Claude Code discovers the skill; the canonical
|
|
8
|
+
content lives in one place to avoid drift between CLI-specific copies.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codevet
|
|
3
|
+
description: Vet a project for security issues (leaked secrets, vulnerable dependencies, missing middleware, personal data flow) before committing, deploying, or trusting a cloned repo.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
See [`AGENTS.md`](../../../AGENTS.md) at the repo root for full instructions —
|
|
7
|
+
this file exists only so Claude Code discovers the skill; the canonical
|
|
8
|
+
content lives in one place to avoid drift between CLI-specific copies.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codevet
|
|
3
|
+
description: Vet a project for security issues (leaked secrets, vulnerable dependencies, missing middleware, personal data flow) before committing, deploying, or trusting a cloned repo.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
See [`AGENTS.md`](../../../AGENTS.md) at the repo root for full instructions —
|
|
7
|
+
this file exists only so Claude Code discovers the skill; the canonical
|
|
8
|
+
content lives in one place to avoid drift between CLI-specific copies.
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# CodeVet — Agent Skill
|
|
2
|
+
|
|
3
|
+
This file is the canonical instructions for using CodeVet from inside an
|
|
4
|
+
AI coding CLI (Claude Code, Cursor, OpenCode, Codex, etc.). Every CLI-specific
|
|
5
|
+
skill file in this repo (`.claude/skills/codevet/SKILL.md`,
|
|
6
|
+
`.cursor/skills/codevet/SKILL.md`, etc.) just points back here — this is
|
|
7
|
+
the one place the actual instructions live.
|
|
8
|
+
|
|
9
|
+
## What this skill does
|
|
10
|
+
|
|
11
|
+
Lets you ask the agent to vet a project's security directly in
|
|
12
|
+
conversation — "scan this repo with CodeVet," "check this project for
|
|
13
|
+
leaked secrets," "is this safe to deploy" — without leaving the coding CLI
|
|
14
|
+
to run a separate tool.
|
|
15
|
+
|
|
16
|
+
## When to use it
|
|
17
|
+
|
|
18
|
+
- Before committing, pushing, or opening a PR
|
|
19
|
+
- Before deploying to production
|
|
20
|
+
- Before cloning and trusting a third-party repo
|
|
21
|
+
- When asked to "check for security issues" or "vet this code"
|
|
22
|
+
|
|
23
|
+
## How to run it
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx codevet scan # scan the current project
|
|
27
|
+
npx codevet scan <path> # scan a specific folder
|
|
28
|
+
npx codevet scan <git-url> # review a repo before keeping a clone
|
|
29
|
+
npx codevet scan --json report.json # machine-readable output
|
|
30
|
+
npx codevet scan --fail-on-high-risk # non-zero exit if anything critical/high is found
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If `codevet` isn't installed yet, `npx codevet` fetches and runs it
|
|
34
|
+
without a global install.
|
|
35
|
+
|
|
36
|
+
## Interpreting results
|
|
37
|
+
|
|
38
|
+
CodeVet reports four categories, each with a severity:
|
|
39
|
+
|
|
40
|
+
- **CRITICAL** — fix before anyone else touches this code (e.g. a
|
|
41
|
+
Supabase table with no Row Level Security)
|
|
42
|
+
- **HIGH** — fix before launch (e.g. missing rate limiting on auth routes,
|
|
43
|
+
a leaked secret, a known-vulnerable dependency)
|
|
44
|
+
- **MODERATE** — real, but rarely the sole cause of an incident on its own
|
|
45
|
+
(e.g. missing security headers)
|
|
46
|
+
- **LOW** — worth doing, not urgent
|
|
47
|
+
|
|
48
|
+
Every finding includes a `Suggested fix` with real, working code — apply
|
|
49
|
+
it directly rather than researching the fix from scratch. When a finding
|
|
50
|
+
has a `Verify:` note, treat that as a genuine caveat: some checks are
|
|
51
|
+
heuristic and can be wrong for unusual setups (e.g. the "no validation
|
|
52
|
+
library" check can't see hand-written validation).
|
|
53
|
+
|
|
54
|
+
## What NOT to do with this skill
|
|
55
|
+
|
|
56
|
+
- Don't silently "fix" every finding without explaining it to the user
|
|
57
|
+
first — some are false positives, and blindly applying every suggested
|
|
58
|
+
fix (especially `codevet remove-dependency`) can break a working app
|
|
59
|
+
- Don't treat a clean scan as a guarantee — CodeVet checks known,
|
|
60
|
+
disclosed issues in specific categories, not a full security audit
|
|
61
|
+
- Don't run `codevet fix --force` or `codevet remove-dependency` without
|
|
62
|
+
explicit user confirmation — these modify the project's dependencies
|
|
63
|
+
|
|
64
|
+
## Related commands
|
|
65
|
+
|
|
66
|
+
- `codevet fix` — safely upgrade flagged dependencies within existing semver ranges
|
|
67
|
+
- `codevet fix --force` — allow major-version upgrades (may need code changes after)
|
|
68
|
+
- `codevet remove-dependency <name>` — explicitly uninstall a flagged package (not the same as fixing it)
|
|
69
|
+
- `codevet clean <path>` — remove a repo CodeVet previously cloned and kept
|
|
70
|
+
- `codevet config disable <secrets|dependencies|hygiene|data-flow|all>` — turn off a specific check for this project
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## The short version
|
|
4
|
+
|
|
5
|
+
Be respectful. Assume good faith. Disagree about code, not about people.
|
|
6
|
+
|
|
7
|
+
## Expected behavior
|
|
8
|
+
|
|
9
|
+
- Give constructive feedback focused on the work, not the person
|
|
10
|
+
- Accept that reasonable people disagree about implementation choices
|
|
11
|
+
- Respect that maintainers are often volunteers with limited time
|
|
12
|
+
|
|
13
|
+
## Unacceptable behavior
|
|
14
|
+
|
|
15
|
+
- Harassment, insults, or personal attacks, in issues, PRs, discussions, or
|
|
16
|
+
anywhere else connected to this project
|
|
17
|
+
- Publishing others' private information without consent
|
|
18
|
+
- Sustained disruption of discussions or reviews
|
|
19
|
+
|
|
20
|
+
## Enforcement
|
|
21
|
+
|
|
22
|
+
Maintainers may remove comments, close discussions, or block contributors
|
|
23
|
+
who violate this code of conduct. Report concerns the same way you'd
|
|
24
|
+
report anything else sensitive — privately, per the contact details in
|
|
25
|
+
`README.md`, not in a public thread.
|
|
26
|
+
|
|
27
|
+
## Scope
|
|
28
|
+
|
|
29
|
+
This applies within all project spaces (issues, pull requests,
|
|
30
|
+
discussions) and in any other setting when someone is representing the
|
|
31
|
+
project publicly.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Contributing to CodeVet
|
|
2
|
+
|
|
3
|
+
## Before you start
|
|
4
|
+
|
|
5
|
+
- Check existing issues/PRs first — avoid duplicate work
|
|
6
|
+
- For anything beyond a small fix, open an issue to discuss the approach
|
|
7
|
+
before writing code
|
|
8
|
+
|
|
9
|
+
## Code quality — not allowed in this codebase
|
|
10
|
+
|
|
11
|
+
- `console.log` left in production code (use structured output through the
|
|
12
|
+
existing report/CLI layers instead)
|
|
13
|
+
- TODOs, placeholder implementations, or fake/mocked scan results outside
|
|
14
|
+
of `tests/`
|
|
15
|
+
- Commented-out code, dead code, unused imports
|
|
16
|
+
- `@ts-ignore` or `as any` used to silence a real type problem instead of
|
|
17
|
+
fixing it
|
|
18
|
+
- A "fix" that only handles the reproduction case shown in an issue —
|
|
19
|
+
trace the actual root cause (see the EXDEV cross-drive bug and the
|
|
20
|
+
Windows `unzip` bug in git history for what root-cause fixes look like
|
|
21
|
+
here, versus a narrow patch)
|
|
22
|
+
|
|
23
|
+
## Engineering standards (please actually follow these)
|
|
24
|
+
|
|
25
|
+
This project deliberately avoids "vibe coding" — generating code until it
|
|
26
|
+
looks like it works. Concretely, that means:
|
|
27
|
+
|
|
28
|
+
- **Understand the change before writing it.** What does it need to do,
|
|
29
|
+
where does it belong, what existing code should it reuse?
|
|
30
|
+
- **Minimum code that correctly solves the problem.** Don't add
|
|
31
|
+
abstraction, config options, or generality a second real use case
|
|
32
|
+
hasn't actually asked for yet.
|
|
33
|
+
- **Every dependency must justify itself.** Before adding a package: can
|
|
34
|
+
Node's standard library do this? Is it maintained? Run `npm audit`
|
|
35
|
+
before proposing it — a vulnerability in a *security tool's* own
|
|
36
|
+
dependency tree undermines the whole project (this has already caught
|
|
37
|
+
one proposed dependency during development — see git history).
|
|
38
|
+
- **No mock data, no fake functionality.** Every finding shown to a user
|
|
39
|
+
must come from a real scanner run against real test data, not a
|
|
40
|
+
hardcoded example.
|
|
41
|
+
- **Type-safe.** Strict TypeScript, no `any`, no unexplained `@ts-ignore`.
|
|
42
|
+
- **Test against a real, reproduced scenario**, not just "it compiles."
|
|
43
|
+
If you're fixing a bug, reproduce it first, then verify the fix against
|
|
44
|
+
that reproduction — a regression test, not just a description.
|
|
45
|
+
|
|
46
|
+
## If you're using an AI coding tool to contribute
|
|
47
|
+
|
|
48
|
+
CodeVet's own audience uses AI coding tools daily, so this comes up a lot
|
|
49
|
+
— the same discipline applies to AI-assisted PRs as to any other:
|
|
50
|
+
|
|
51
|
+
- Generate only the files the change actually requires — an AI tool
|
|
52
|
+
"helpfully" refactoring unrelated files, renaming things, or reorganizing
|
|
53
|
+
folders outside the scope of the change will be asked to be reverted
|
|
54
|
+
- Don't let the AI invent architecture or add a dependency the issue
|
|
55
|
+
didn't call for — if it suggests one, evaluate it against the
|
|
56
|
+
Dependencies rule above before including it in the PR
|
|
57
|
+
A locked pattern in this codebase (e.g. scanners always wrap a real
|
|
58
|
+
external tool, never reimplement detection) should not get silently
|
|
59
|
+
"improved" away because a different approach seemed cleaner
|
|
60
|
+
- Ask for the complete implementation, not `// rest of the code...` or
|
|
61
|
+
`// TODO: implement error handling` — incomplete generated code should
|
|
62
|
+
never reach a PR
|
|
63
|
+
- Run the real verification steps below yourself before opening the PR —
|
|
64
|
+
"the AI said it works" is not the same as it actually working against
|
|
65
|
+
real test data, and this project's whole history (see git log) is full
|
|
66
|
+
of cases where something that looked correct had a real bug underneath
|
|
67
|
+
|
|
68
|
+
## Definition of done
|
|
69
|
+
|
|
70
|
+
A change is not complete until it is:
|
|
71
|
+
|
|
72
|
+
- Production-ready (no placeholder or "good enough for now" behavior)
|
|
73
|
+
- Type-safe (strict TypeScript, `npx tsc --noEmit` clean)
|
|
74
|
+
- Tested against a real, reproduced scenario (not just "it compiles")
|
|
75
|
+
- Free of dead code, TODOs, and stray `console.log`
|
|
76
|
+
- Passing `npm test` and showing `0 vulnerabilities` from `npm audit`
|
|
77
|
+
- Verified with `node dist/index.js scan .` (CodeVet against its own code)
|
|
78
|
+
|
|
79
|
+
Anything less is incomplete, regardless of how small the change looks.
|
|
80
|
+
|
|
81
|
+
## Setting up locally
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
git clone https://github.com/i-akb25/codevet.git
|
|
85
|
+
cd codevet
|
|
86
|
+
npm install
|
|
87
|
+
npm run build
|
|
88
|
+
node dist/index.js scan . # should complete cleanly against this repo itself
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Before opening a PR
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
npm run build # must compile with zero TypeScript errors
|
|
95
|
+
npm audit # must show 0 vulnerabilities before you add a dependency
|
|
96
|
+
node dist/index.js scan . # sanity-check CodeVet against its own code
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Adding a new scanner
|
|
100
|
+
|
|
101
|
+
Each scanner lives in `src/scanners/`, wraps a real, trusted external tool
|
|
102
|
+
(never reimplements detection logic from scratch), and exports a function
|
|
103
|
+
returning normalized findings — follow the shape of
|
|
104
|
+
`src/scanners/gitleaksScanner.ts` or `npmAuditScanner.ts` as a template.
|
|
105
|
+
|
|
106
|
+
## A known, accepted noise source in CodeVet's own self-scan
|
|
107
|
+
|
|
108
|
+
When CodeVet scans its own repo, Bearer's data-flow check flags roughly
|
|
109
|
+
70 LOW-severity "logger leak" findings across `src/index.ts` and
|
|
110
|
+
`src/report.ts`. This is expected, not a bug: those files' entire job is
|
|
111
|
+
printing scan results to the terminal — that's the CLI's actual output,
|
|
112
|
+
not a leak. This is specific to a CLI tool scanning itself; it does not
|
|
113
|
+
affect Bearer's real value for a typical backend app, where
|
|
114
|
+
`console.log`-ing a password or SSN genuinely is a problem worth catching.
|
|
115
|
+
|
|
116
|
+
**A real false positive was found and fixed here, worth knowing about
|
|
117
|
+
directly:** `src/fixLibrary/templates.ts` is a library of example code
|
|
118
|
+
shown to users (including a variable named `SECRET` correctly read from
|
|
119
|
+
`process.env` — the safe pattern we specifically teach). Bearer's static
|
|
120
|
+
analysis flagged that as a CRITICAL hardcoded secret before we added
|
|
121
|
+
`--skip-path` for fix-library/template directories in
|
|
122
|
+
`src/scanners/bearerScanner.ts`. Any new template file added to that
|
|
123
|
+
scanner needs to stay covered by that skip-path — verify with
|
|
124
|
+
`node dist/index.js scan . --no-secrets --no-dependencies --no-hygiene`
|
|
125
|
+
before merging.
|
|
126
|
+
|
|
127
|
+
## Questions
|
|
128
|
+
|
|
129
|
+
Open a discussion or issue — this file will grow as real contribution
|
|
130
|
+
patterns emerge, rather than trying to anticipate everything upfront.
|
package/INFO.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# INFO.md — What every file and folder in this repo is for
|
|
2
|
+
|
|
3
|
+
This is the complete map of the repository: what each piece does, who
|
|
4
|
+
actually needs to touch it, and how to use it. If you're new to this repo,
|
|
5
|
+
read this before poking around.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The short version — what you actually need, by role
|
|
10
|
+
|
|
11
|
+
**Just want to use CodeVet?** You need none of this repo directly —
|
|
12
|
+
`npm install -g codevet-cli`. Read [`README.md`](./README.md) and
|
|
13
|
+
[`docs/HELP.md`](./docs/HELP.md).
|
|
14
|
+
|
|
15
|
+
**Want to contribute code?** You need `src/`, `tests/`, and
|
|
16
|
+
[`CONTRIBUTING.md`](./CONTRIBUTING.md). Everything under `dist/` and
|
|
17
|
+
`templates/` is *generated* — never hand-edit it.
|
|
18
|
+
|
|
19
|
+
**Want to understand a specific check's logic?** Go straight to
|
|
20
|
+
`src/scanners/<name>.ts` — each one is self-contained and documented.
|
|
21
|
+
|
|
22
|
+
**Want to package/deploy CodeVet somewhere new?** You need `package.json`,
|
|
23
|
+
`scripts/postinstall.mjs`, and `action.yml`.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Root-level files
|
|
28
|
+
|
|
29
|
+
| File | What it is | Who touches it |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| `README.md` | The landing page — install, usage, what it checks | Anyone updating the public-facing pitch |
|
|
32
|
+
| `INFO.md` | This file — the full repo map | Anyone adding/removing/renaming a file (keep this in sync) |
|
|
33
|
+
| `AGENTS.md` | Canonical instructions for using CodeVet from inside an AI coding CLI (Claude Code, Cursor, etc.) — the single source of truth all `.claude/`, `.cursor/`, `.opencode/` skill files point back to | Anyone changing how the CLI should be used conversationally |
|
|
34
|
+
| `CLAUDE.md` | One-line pointer to `AGENTS.md`, so Claude Code picks up the instructions automatically | Rarely — only if the pointer pattern itself changes |
|
|
35
|
+
| `LICENSE` | MIT license text | Legal only |
|
|
36
|
+
| `PRIVACY.md` | Exactly what data each check touches and where it goes (no telemetry, no CodeVet server) | Update if a new scanner talks to a new external service |
|
|
37
|
+
| `TERMS.md` | What a scan result does and doesn't mean — no-warranty language | Update if the product's scope/guarantees change |
|
|
38
|
+
| `SECURITY.md` | How to report a vulnerability *in CodeVet itself* (private disclosure) | Rarely |
|
|
39
|
+
| `CODE_OF_CONDUCT.md` | Standard OSS contributor conduct policy | Rarely |
|
|
40
|
+
| `CONTRIBUTING.md` | Engineering standards, code-quality bans, Definition of Done, AI-assisted-contribution guidance | Update when the engineering bar or contribution process changes |
|
|
41
|
+
| `action.yml` | The composite GitHub Action definition — what `uses: codevet/codevet@v1` actually runs in someone else's CI | Update when the scan command's flags or the PR-comment flow changes |
|
|
42
|
+
| `package.json` | Dependencies, `bin` entry (makes `codevet` a real command), build/test/publish scripts | Anyone adding a dependency or changing how the package is built/published |
|
|
43
|
+
| `tsconfig.json` | TypeScript compiler config — strict mode on | Rarely |
|
|
44
|
+
| `package-lock.json` | Locked dependency versions | Auto-managed by npm, don't hand-edit |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## `src/` — the actual source code (edit this, not `dist/`)
|
|
49
|
+
|
|
50
|
+
| Path | What it is |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `src/index.ts` | The CLI entry point — wires every scanner together, defines all commands (`scan`, `fix`, `remove-dependency`, `clean`, `config`), handles the existence check, error handling, and the pre-clone confirmation flow |
|
|
53
|
+
| `src/report.ts` | Formats every scanner's output into the human-readable report — severity labels (CRITICAL/HIGH/MODERATE/LOW), the `hasFindings`/`hasHighRiskFindings` logic that CI gating depends on |
|
|
54
|
+
| `src/config.ts` | Reads/writes `.codevet/config.json` (per-project enable/disable toggles) — **only trusted for a project the user owns locally**, never for an untrusted clone (see the security note in the file itself) |
|
|
55
|
+
| `src/resolveTarget.ts` | Turns CLI args into an actual scan target — handles unquoted multi-word paths, git/GitHub URL cloning, persisting or discarding a clone, the provenance marker `codevet clean` relies on |
|
|
56
|
+
| `src/promptConfirm.ts` | The y/N confirmation prompt (built on Node's own `readline`, no extra dependency) |
|
|
57
|
+
| `src/detectors/detectStack.ts` | Looks for `package.json`/`requirements.txt`/`build.gradle`/`Podfile` to identify which stack(s) are present |
|
|
58
|
+
| `src/fixLibrary/templates.ts` | **Single source of truth** for every suggested-fix code snippet (helmet, CORS, rate limiter, account backoff, error handler, password hashing, JWT, validation, file upload, `.env.example`, RLS-enable SQL, the CI workflow template, the pre-commit hook template) |
|
|
59
|
+
| `src/scanners/gitleaksScanner.ts` | Wraps the vendored `gitleaks` binary — secret detection |
|
|
60
|
+
| `src/scanners/npmAuditScanner.ts` | Wraps `npm audit` — Node dependency vulnerabilities |
|
|
61
|
+
| `src/scanners/pipAuditScanner.ts` | Wraps `pip-audit` — Python dependency vulnerabilities (supports both `requirements.txt` and `pyproject.toml`) |
|
|
62
|
+
| `src/scanners/bearerScanner.ts` | Wraps the vendored `bearer` binary — personal data flow (PII logging, etc.); no native Windows build, handled gracefully |
|
|
63
|
+
| `src/scanners/hygieneScanner.ts` | CodeVet's own heuristic scanner — missing middleware, error leaks, Supabase RLS gaps — maps every finding to a real fix template |
|
|
64
|
+
| `src/scanners/npmFixActions.ts` | Backs the `fix` and `remove-dependency` commands |
|
|
65
|
+
|
|
66
|
+
**Every scanner file follows the same shape:** wraps a real, trusted
|
|
67
|
+
external tool (never reimplements detection logic), exports a function
|
|
68
|
+
returning normalized findings, and throws a specific error class when the
|
|
69
|
+
tool genuinely fails — never silently returns an empty result on failure.
|
|
70
|
+
Follow this pattern for any new scanner (see `CONTRIBUTING.md`).
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## `dist/` — compiled output (generated, never hand-edit)
|
|
75
|
+
|
|
76
|
+
Produced by `npm run build` (`tsc`). This is what actually ships when
|
|
77
|
+
someone installs the package — `src/` is only needed by contributors
|
|
78
|
+
editing the tool. If you edit anything in `dist/` directly, it'll be
|
|
79
|
+
silently overwritten on the next build.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## `templates/` — human-browsable fix-library files (generated)
|
|
84
|
+
|
|
85
|
+
A plain, readable copy of every fix template from `src/fixLibrary/templates.ts`,
|
|
86
|
+
regenerated via `npm run generate-templates`. This exists so someone can
|
|
87
|
+
browse the actual fix code on GitHub without reading TypeScript string
|
|
88
|
+
literals. **Never hand-edit files under here** — edit `templates.ts` and
|
|
89
|
+
regenerate. `scripts/generateTemplates.mjs` is what performs the generation.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## `scripts/` — standalone Node scripts (not part of the compiled CLI)
|
|
94
|
+
|
|
95
|
+
| File | What it does |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `scripts/postinstall.mjs` | Runs automatically after `npm install` — downloads the correct `gitleaks`/`bearer` binary for the installing machine's OS/architecture. Skips `bearer` cleanly on Windows (no native build exists) |
|
|
98
|
+
| `scripts/generateTemplates.mjs` | Regenerates `templates/` from `src/fixLibrary/templates.ts` |
|
|
99
|
+
| `scripts/postPrComment.mjs` | Used by `action.yml` — formats a JSON scan report as Markdown and posts it as a PR comment via the GitHub REST API |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## `tests/` — the automated test suite
|
|
104
|
+
|
|
105
|
+
Run with `npm test`. Uses Node's built-in test runner (`node:test`), no
|
|
106
|
+
external test framework — one less dependency to justify. Each scanner
|
|
107
|
+
that can be tested without a real network call has real, reproduced test
|
|
108
|
+
cases (a vulnerable fixture, a clean fixture) — not mocked data.
|
|
109
|
+
|
|
110
|
+
| File | Covers |
|
|
111
|
+
|---|---|
|
|
112
|
+
| `tests/config.test.ts` | `.codevet/config.json` load/save, `.gitignore` auto-append |
|
|
113
|
+
| `tests/detectStack.test.ts` | Stack detection across Node/Python/multi-stack/unrecognized projects |
|
|
114
|
+
| `tests/hygieneScanner.test.ts` | Every hygiene check — helmet, error leaks, CORS, Supabase RLS (both Express and non-Express projects) |
|
|
115
|
+
| `tests/fixtures/` | Present but currently empty — tests build fixtures inline (temp directories created and torn down per-test) rather than static files here. Kept as the conventional place to add static fixtures if a future test needs one |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## `docs/` — reference documentation
|
|
120
|
+
|
|
121
|
+
| File | What it is |
|
|
122
|
+
|---|---|
|
|
123
|
+
| `docs/HELP.md` | The complete command reference — every flag, every subcommand, kept in sync with actual `--help` output |
|
|
124
|
+
| `docs/ABOUT.md` | Project philosophy, why it exists, explicit scope boundaries |
|
|
125
|
+
| `docs/SECURITY-CHECKLIST.md` | The full severity-annotated security checklist CodeVet's automated checks are built around, including what stays a human judgment call |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## `.claude/`, `.cursor/`, `.opencode/` — Agent Skill packaging
|
|
130
|
+
|
|
131
|
+
Each contains a thin `skills/codevet/SKILL.md` that just points back to
|
|
132
|
+
the canonical `AGENTS.md` at the repo root — so there's exactly one place
|
|
133
|
+
the actual instructions live, no risk of the copies drifting out of sync.
|
|
134
|
+
This is what lets someone ask their AI coding CLI to "scan this with
|
|
135
|
+
CodeVet" directly in conversation.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## `bin/vendor/` (not committed — created by `postinstall.mjs`)
|
|
140
|
+
|
|
141
|
+
Where the downloaded `gitleaks`/`bearer` binaries actually live after
|
|
142
|
+
install. Gitignored, platform-specific, regenerated by every fresh
|
|
143
|
+
`npm install`.
|
package/PRIVACY.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Privacy Policy
|
|
2
|
+
|
|
3
|
+
CodeVet is a local command-line tool. There is no CodeVet server, no account,
|
|
4
|
+
and no telemetry — this document describes exactly what data the tool
|
|
5
|
+
touches and where it goes, based on what the code actually does.
|
|
6
|
+
|
|
7
|
+
## What CodeVet does NOT do
|
|
8
|
+
|
|
9
|
+
- It does not collect, transmit, or store analytics about you or your usage
|
|
10
|
+
- It does not send your source code, file contents, or scan results to any
|
|
11
|
+
CodeVet-operated server — there isn't one
|
|
12
|
+
- It does not require a sign-up, account, or API key to use
|
|
13
|
+
|
|
14
|
+
## What actually happens when you run a scan
|
|
15
|
+
|
|
16
|
+
**Secret scanning (`gitleaks`)** — runs entirely on your machine, reading
|
|
17
|
+
files from the path you point it at. Nothing leaves your machine during
|
|
18
|
+
this step.
|
|
19
|
+
|
|
20
|
+
**Dependency scanning (`npm audit`)** — this step sends your project's
|
|
21
|
+
package names and version numbers to the public npm registry
|
|
22
|
+
(`registry.npmjs.org`) so it can be checked against npm's own published
|
|
23
|
+
vulnerability advisory database. This is standard `npm audit` behavior,
|
|
24
|
+
identical to running it yourself directly — CodeVet does not add any
|
|
25
|
+
additional data to that request, and the registry is operated by npm/GitHub,
|
|
26
|
+
not by CodeVet.
|
|
27
|
+
|
|
28
|
+
**Scanning a git/GitHub URL** — CodeVet runs a normal `git clone` against
|
|
29
|
+
the URL you provide. This follows whatever access rules that repository
|
|
30
|
+
host already has (e.g. a private GitHub repo still requires your existing
|
|
31
|
+
git credentials — CodeVet doesn't bypass or store these).
|
|
32
|
+
|
|
33
|
+
**Installing CodeVet itself** — the `postinstall` step downloads the
|
|
34
|
+
`gitleaks` binary directly from its official GitHub releases page, matched
|
|
35
|
+
to your OS/architecture. No user data is included in that request.
|
|
36
|
+
|
|
37
|
+
## Local files CodeVet creates
|
|
38
|
+
|
|
39
|
+
- `.codevet/config.json` — stores which scanners you've enabled/disabled
|
|
40
|
+
for a project. Stays on your machine, auto-added to `.gitignore`, never
|
|
41
|
+
transmitted anywhere.
|
|
42
|
+
- Temporary clone folders (for URL scans) — created under your OS's temp
|
|
43
|
+
directory, deleted automatically unless you choose to keep the result.
|
|
44
|
+
|
|
45
|
+
## Third-party services this tool talks to
|
|
46
|
+
|
|
47
|
+
| Service | What for | Whose policy applies |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| npm registry (`registry.npmjs.org`) | Dependency vulnerability lookups | [npm's privacy policy](https://docs.npmjs.com/policies/privacy) |
|
|
50
|
+
| GitHub (`github.com`, releases) | Downloading the gitleaks binary; cloning repos you point CodeVet at | [GitHub's privacy statement](https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement) |
|
|
51
|
+
|
|
52
|
+
## Compliance posture (India's DPDP Act, and equivalents elsewhere)
|
|
53
|
+
|
|
54
|
+
CodeVet does not collect, store, or process personal data as defined under
|
|
55
|
+
India's Digital Personal Data Protection Act, 2023 (or GDPR, CCPA, etc.) —
|
|
56
|
+
there is no CodeVet-operated backend for any personal data to flow into.
|
|
57
|
+
Scanning happens entirely on your machine; the only external calls are the
|
|
58
|
+
ones described above (npm registry, GitHub), each governed by that
|
|
59
|
+
service's own policy, not CodeVet's.
|
|
60
|
+
|
|
61
|
+
If CodeVet ever introduces a feature that does process personal data (for
|
|
62
|
+
example, an account-based hosted dashboard), that feature will document
|
|
63
|
+
its own lawful basis, retention period, and user rights under applicable
|
|
64
|
+
law before it ships — not retroactively.
|
|
65
|
+
|
|
66
|
+
## Changes to this policy
|
|
67
|
+
|
|
68
|
+
If CodeVet ever adds a feature that changes this (for example, an optional
|
|
69
|
+
hosted dashboard mentioned as a possible future addition), that feature
|
|
70
|
+
will be opt-in and this document will be updated to describe it plainly
|
|
71
|
+
before it ships.
|
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Full command reference: [`docs/HELP.md`](./docs/HELP.md).
|
|
|
61
61
|
|
|
62
62
|
| Check | Tool | Severity model |
|
|
63
63
|
|---|---|---|
|
|
64
|
-
| Leaked secrets — API keys, credentials, connection strings, Supabase service-role-key exposure | `gitleaks` (extended ruleset) |
|
|
64
|
+
| Leaked secrets — API keys, credentials, connection strings, Supabase service-role-key exposure | `gitleaks` (extended ruleset) | High-confidence pattern matches — still worth a quick look, since any pattern-based scanner can flag example/fixture/documentation code that only looks like a real secret |
|
|
65
65
|
| Dependency vulnerabilities (Node) | `npm audit` | CRITICAL/HIGH/MODERATE/LOW from the advisory database. Skipped (not failed) on pnpm-managed projects — a confirmed bug in npm itself, run `pnpm audit` directly for those |
|
|
66
66
|
| Dependency vulnerabilities (Python) | `pip-audit` | Unranked — PyPA's database has no severity field; prioritize by whether a fix exists |
|
|
67
67
|
| Missing security middleware — no helmet, no rate limiting, wide-open CORS, error responses leaking internals, missing Supabase Row Level Security | CodeVet's own heuristic scanner | CRITICAL/HIGH/MODERATE, each with a `Verify:` note on how the check could be wrong |
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
CodeVet is a security tool, so vulnerabilities in its own code are treated
|
|
4
|
+
seriously and reviewed quickly.
|
|
5
|
+
|
|
6
|
+
## Reporting a vulnerability
|
|
7
|
+
|
|
8
|
+
**Please do not open a public GitHub issue for security vulnerabilities.**
|
|
9
|
+
Instead, use GitHub's private vulnerability reporting (Security tab →
|
|
10
|
+
"Report a vulnerability") on this repository, or email the maintainers
|
|
11
|
+
directly (see `README.md` for current contact details).
|
|
12
|
+
|
|
13
|
+
Please include:
|
|
14
|
+
- A description of the vulnerability and its potential impact
|
|
15
|
+
- Steps to reproduce it
|
|
16
|
+
- Which version of CodeVet you tested against
|
|
17
|
+
|
|
18
|
+
## What happens next
|
|
19
|
+
|
|
20
|
+
- We'll acknowledge your report as soon as possible
|
|
21
|
+
- We'll investigate and let you know if it's confirmed, and roughly how
|
|
22
|
+
long a fix will take
|
|
23
|
+
- We'll credit you in the fix's changelog, unless you'd prefer to stay
|
|
24
|
+
anonymous
|
|
25
|
+
- Please give us a reasonable window to ship a fix before any public
|
|
26
|
+
disclosure
|
|
27
|
+
|
|
28
|
+
## Scope
|
|
29
|
+
|
|
30
|
+
This policy covers CodeVet's own code (the CLI, the GitHub Action, the
|
|
31
|
+
postinstall script, the bundled `.gitleaks.toml` rules). It does not cover
|
|
32
|
+
vulnerabilities in the third-party tools CodeVet wraps (`gitleaks`,
|
|
33
|
+
`npm`/`npm audit`) — please report those directly to their respective
|
|
34
|
+
maintainers.
|
|
35
|
+
|
|
36
|
+
## A note on irony
|
|
37
|
+
|
|
38
|
+
Yes, a security scanner having its own vulnerabilities is exactly the kind
|
|
39
|
+
of thing it's supposed to help catch elsewhere. `npm audit` runs against
|
|
40
|
+
this project's own dependencies as part of CI for that reason — see
|
|
41
|
+
`CONTRIBUTING.md` for how that's enforced before any change is merged.
|
package/TERMS.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Terms of Use
|
|
2
|
+
|
|
3
|
+
By downloading, installing, or using CodeVet, you agree to the following.
|
|
4
|
+
|
|
5
|
+
## What CodeVet is
|
|
6
|
+
|
|
7
|
+
CodeVet is a free, open-source command-line tool that runs trusted
|
|
8
|
+
third-party security scanners (currently `gitleaks` for leaked secrets and
|
|
9
|
+
`npm audit` for known dependency vulnerabilities) against code you point it
|
|
10
|
+
at, and presents the results in plain language.
|
|
11
|
+
|
|
12
|
+
## No warranty, "as is"
|
|
13
|
+
|
|
14
|
+
CodeVet is provided **as is**, without warranty of any kind, under the MIT
|
|
15
|
+
License (see `LICENSE`). In plain terms:
|
|
16
|
+
|
|
17
|
+
- **CodeVet does not guarantee the absence of security vulnerabilities.**
|
|
18
|
+
It surfaces *known, disclosed* issues via established scanners — it
|
|
19
|
+
cannot detect novel vulnerabilities, zero-days, or issues outside the
|
|
20
|
+
categories it currently checks (leaked secrets, known-vulnerable
|
|
21
|
+
dependencies).
|
|
22
|
+
- **A clean scan result is not a certification.** It means the specific
|
|
23
|
+
checks CodeVet currently runs found nothing — it is not a statement that
|
|
24
|
+
the code is secure overall.
|
|
25
|
+
- **CodeVet is not a substitute for a professional security audit.**
|
|
26
|
+
Anything handling real user data, payments, or production traffic at
|
|
27
|
+
meaningful scale should still get a human security review before launch,
|
|
28
|
+
regardless of what CodeVet reports.
|
|
29
|
+
|
|
30
|
+
## Your responsibility when scanning a repository
|
|
31
|
+
|
|
32
|
+
The pre-clone review feature (`codevet scan <url>`) shows you findings and
|
|
33
|
+
asks whether to keep a cloned repository. **CodeVet does not scan for
|
|
34
|
+
malware, viruses, or intentionally obfuscated malicious code beyond what
|
|
35
|
+
its underlying scanners cover** (currently: leaked secrets and known CVEs
|
|
36
|
+
in dependencies). Choosing to keep a repository despite a warning, or
|
|
37
|
+
running code from any repository at all, is done at your own judgment and
|
|
38
|
+
risk.
|
|
39
|
+
|
|
40
|
+
## Acceptable use
|
|
41
|
+
|
|
42
|
+
CodeVet is free to use, modify, and redistribute under the MIT License.
|
|
43
|
+
Don't use it, or represent it, in a way that implies a guarantee or
|
|
44
|
+
certification CodeVet does not actually provide (see "No warranty" above).
|
|
45
|
+
|
|
46
|
+
## Changes
|
|
47
|
+
|
|
48
|
+
These terms may be updated as CodeVet's feature set changes. Material
|
|
49
|
+
changes will be reflected here directly, in plain language, not buried in
|
|
50
|
+
a changelog.
|
|
51
|
+
|
|
52
|
+
## Related documents
|
|
53
|
+
|
|
54
|
+
- [`PRIVACY.md`](./PRIVACY.md) — what data the tool touches and where it goes
|
|
55
|
+
- [`SECURITY.md`](./SECURITY.md) — how to report a vulnerability in CodeVet itself
|
|
56
|
+
- [`LICENSE`](./LICENSE) — the MIT License text
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { mkdir, chmod, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import { mkdir, chmod, rm, writeFile, readFile } from "node:fs/promises";
|
|
3
3
|
import { join, dirname } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { execFile } from "node:child_process";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
7
8
|
const execFileAsync = promisify(execFile);
|
|
8
9
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
10
|
// This file lives at dist/scanners/ensureBinary.js at runtime — two levels
|
|
@@ -12,6 +13,33 @@ const PACKAGE_ROOT = join(__dirname, "..", "..");
|
|
|
12
13
|
const VENDOR_DIR = join(PACKAGE_ROOT, "bin", "vendor");
|
|
13
14
|
const GITLEAKS_VERSION = "8.30.1";
|
|
14
15
|
const BEARER_VERSION = "2.1.0";
|
|
16
|
+
// Pinned SHA-256 checksums, verified by us against each project's own
|
|
17
|
+
// published checksums.txt at the time this version was pinned — NOT
|
|
18
|
+
// fetched dynamically alongside the binary itself. Fetching a checksum
|
|
19
|
+
// from the same GitHub release as the binary it's meant to verify
|
|
20
|
+
// provides no real protection (an attacker who could tamper with one
|
|
21
|
+
// could tamper with both); a hash pinned in our own source, reviewed at
|
|
22
|
+
// a different time, is what actually catches a compromised or corrupted
|
|
23
|
+
// download. Real, verified security concern raised in external review —
|
|
24
|
+
// addressed properly here rather than skipped.
|
|
25
|
+
const CHECKSUMS = {
|
|
26
|
+
"gitleaks_8.30.1_darwin_arm64.tar.gz": "b40ab0ae55c505963e365f271a8d3846efbc170aa17f2607f13df610a9aeb6a5",
|
|
27
|
+
"gitleaks_8.30.1_darwin_x64.tar.gz": "dfe101a4db2255fc85120ac7f3d25e4342c3c20cf749f2c20a18081af1952709",
|
|
28
|
+
"gitleaks_8.30.1_linux_arm64.tar.gz": "e4a487ee7ccd7d3a7f7ec08657610aa3606637dab924210b3aee62570fb4b080",
|
|
29
|
+
"gitleaks_8.30.1_linux_x64.tar.gz": "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb",
|
|
30
|
+
"gitleaks_8.30.1_windows_arm64.zip": "b95f5e4f5c425cedca7ee203d9afd29597e692c4924a12ed42f970537c72cc0f",
|
|
31
|
+
"gitleaks_8.30.1_windows_x64.zip": "d29144deff3a68aa93ced33dddf84b7fdc26070add4aa0f4513094c8332afc4e",
|
|
32
|
+
"bearer_2.1.0_darwin_amd64.tar.gz": "d08f3b74724619e4dc8f4673085ce16df4d881e5e104a85b6104498431e6a777",
|
|
33
|
+
"bearer_2.1.0_darwin_arm64.tar.gz": "8ffcda3cff9ed7c74a1727e5fbd6caf056d076e61ae30bf65428eafde56e8549",
|
|
34
|
+
"bearer_2.1.0_linux_amd64.tar.gz": "0bd1129669dbfa2461ba64f2cf99b9cb1fc8c0ca35fb27fdfdf3d3f4146ec7b9",
|
|
35
|
+
"bearer_2.1.0_linux_arm64.tar.gz": "3bec731fe183881b7999193f5958b80db5e0925a6171083514c160392a2dade4",
|
|
36
|
+
};
|
|
37
|
+
export class ChecksumMismatchError extends Error {
|
|
38
|
+
constructor(assetName, expected, actual) {
|
|
39
|
+
super(`SECURITY: downloaded file "${assetName}" does not match its pinned checksum. Expected ${expected}, got ${actual}. The download has been deleted and will NOT be executed. This could mean a corrupted download or a compromised release — do not retry without investigating.`);
|
|
40
|
+
this.name = "ChecksumMismatchError";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
15
43
|
function resolveGitleaksSpec() {
|
|
16
44
|
const platformMap = { linux: "linux", darwin: "darwin", win32: "windows" };
|
|
17
45
|
const archMap = { x64: "x64", arm64: "arm64" };
|
|
@@ -28,6 +56,7 @@ function resolveGitleaksSpec() {
|
|
|
28
56
|
url: `https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/${assetName}`,
|
|
29
57
|
ext,
|
|
30
58
|
binName,
|
|
59
|
+
assetName,
|
|
31
60
|
};
|
|
32
61
|
}
|
|
33
62
|
function resolveBearerSpec() {
|
|
@@ -46,6 +75,7 @@ function resolveBearerSpec() {
|
|
|
46
75
|
url: `https://github.com/Bearer/bearer/releases/download/v${BEARER_VERSION}/${assetName}`,
|
|
47
76
|
ext: "tar.gz",
|
|
48
77
|
binName: "bearer",
|
|
78
|
+
assetName,
|
|
49
79
|
};
|
|
50
80
|
}
|
|
51
81
|
async function downloadAndExtract(spec) {
|
|
@@ -57,6 +87,22 @@ async function downloadAndExtract(spec) {
|
|
|
57
87
|
}
|
|
58
88
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
59
89
|
await writeFile(archivePath, buf);
|
|
90
|
+
// Verify against the pinned checksum BEFORE extracting or executing
|
|
91
|
+
// anything. If there's no pinned hash for this exact asset (e.g. a
|
|
92
|
+
// platform/version combo added later without updating CHECKSUMS), fail
|
|
93
|
+
// closed rather than silently skip verification — a security tool
|
|
94
|
+
// should never extract an unverified binary.
|
|
95
|
+
const expectedHash = CHECKSUMS[spec.assetName];
|
|
96
|
+
if (!expectedHash) {
|
|
97
|
+
await rm(archivePath).catch(() => { });
|
|
98
|
+
throw new Error(`No pinned checksum found for "${spec.assetName}" — refusing to extract an unverified binary. This is a CodeVet bug (a supported platform is missing from its own checksum table), not a download problem.`);
|
|
99
|
+
}
|
|
100
|
+
const fileBuffer = await readFile(archivePath);
|
|
101
|
+
const actualHash = createHash("sha256").update(fileBuffer).digest("hex");
|
|
102
|
+
if (actualHash !== expectedHash) {
|
|
103
|
+
await rm(archivePath).catch(() => { });
|
|
104
|
+
throw new ChecksumMismatchError(spec.assetName, expectedHash, actualHash);
|
|
105
|
+
}
|
|
60
106
|
if (spec.ext === "tar.gz") {
|
|
61
107
|
await execFileAsync("tar", ["-xzf", archivePath, "-C", VENDOR_DIR, spec.binName]);
|
|
62
108
|
}
|
package/docs/ABOUT.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# About CodeVet
|
|
2
|
+
|
|
3
|
+
## What it is
|
|
4
|
+
|
|
5
|
+
CodeVet is a free, open-source security co-pilot for developers who aren't
|
|
6
|
+
security experts — students, solo/indie developers, and small teams who
|
|
7
|
+
can't justify (or don't yet need) an enterprise AppSec platform.
|
|
8
|
+
|
|
9
|
+
Instead of building yet another scanning engine, CodeVet orchestrates
|
|
10
|
+
trusted, independently-maintained tools (`gitleaks`, `npm audit`, with more
|
|
11
|
+
planned) and translates their output into plain language: what's wrong, why
|
|
12
|
+
it matters in practice, and — where possible — the exact fix.
|
|
13
|
+
|
|
14
|
+
## Why it exists
|
|
15
|
+
|
|
16
|
+
Every existing free security tool is built for teams that already have
|
|
17
|
+
security expertise. Nobody was serving the developer who's never heard of
|
|
18
|
+
a CVE, doesn't know what CVSS means, and just wants to know if it's safe to
|
|
19
|
+
ship. That gap is what CodeVet is for.
|
|
20
|
+
|
|
21
|
+
## What it currently does
|
|
22
|
+
|
|
23
|
+
- Scans for leaked secrets and credentials (via `gitleaks`, with an
|
|
24
|
+
extended ruleset for cases the defaults miss, like connection-string
|
|
25
|
+
credentials)
|
|
26
|
+
- Scans dependencies for known, disclosed vulnerabilities (via `npm audit`)
|
|
27
|
+
- Lets you review a repository's risk *before* deciding to keep a local
|
|
28
|
+
clone of it
|
|
29
|
+
- Runs entirely locally — no account, no server, no telemetry (see
|
|
30
|
+
`PRIVACY.md`)
|
|
31
|
+
|
|
32
|
+
## What it doesn't do (yet, or by design)
|
|
33
|
+
|
|
34
|
+
- It is not a malware/antivirus scanner
|
|
35
|
+
- It does not detect novel or zero-day vulnerabilities — only known,
|
|
36
|
+
disclosed issues in its scanners' databases
|
|
37
|
+
- It is not a replacement for a professional security audit on anything
|
|
38
|
+
handling real user data or payments at meaningful scale
|
|
39
|
+
|
|
40
|
+
See `TERMS.md` for the full, precise scope of what a scan result does and
|
|
41
|
+
doesn't mean.
|
|
42
|
+
|
|
43
|
+
## Project values
|
|
44
|
+
|
|
45
|
+
- **No fake security** — findings are real, sourced from trusted scanners,
|
|
46
|
+
never simulated or implied
|
|
47
|
+
- **No vibe coding** — every module has a defined responsibility, is
|
|
48
|
+
type-checked in strict mode, and is tested against real, reproduced
|
|
49
|
+
scenarios before being considered done
|
|
50
|
+
- **Minimum dependencies** — every third-party package is chosen
|
|
51
|
+
deliberately (and audited — see `SECURITY.md`)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT — see `LICENSE`.
|
package/docs/HELP.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Help
|
|
2
|
+
|
|
3
|
+
## Installing
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install -g codevet-cli # global install, gives you the `codevet` command anywhere
|
|
7
|
+
# or
|
|
8
|
+
npm install --save-dev codevet-cli # install into a specific project, run via `npx codevet`
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Scanning
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
codevet scan # scans the current directory
|
|
15
|
+
codevet scan ./some/folder # scans a specific local folder
|
|
16
|
+
codevet scan https://github.com/user/repo # clones and scans a repo before you keep it
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If your path has spaces and you forget to quote it, CodeVet will try to
|
|
20
|
+
rejoin it automatically and tell you it did so. Quoting the path yourself
|
|
21
|
+
(`codevet scan "C:\My Projects\app"`) is still the reliable way.
|
|
22
|
+
|
|
23
|
+
### Options
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
codevet scan --no-secrets # skip the secret-scanning check, this run only
|
|
27
|
+
codevet scan --no-dependencies # skip the dependency-vulnerability check, this run only
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Scanning a repository before you trust it
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
codevet scan https://github.com/someone/some-repo
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- If nothing is found, the repo is automatically kept in your current
|
|
37
|
+
directory.
|
|
38
|
+
- If something is found, you'll see exactly what and be asked whether you
|
|
39
|
+
still want to keep it. Answering no discards it completely — nothing is
|
|
40
|
+
left behind.
|
|
41
|
+
|
|
42
|
+
## Turning scanners on/off for a project
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
codevet config status # see what's currently enabled
|
|
46
|
+
codevet config disable dependencies # turn off dependency scanning for this project
|
|
47
|
+
codevet config enable secrets # turn a scanner back on
|
|
48
|
+
codevet config disable all # turn everything off
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This is stored in `.codevet/config.json` inside the project and only
|
|
52
|
+
applies to a project you're scanning locally — it has no effect when
|
|
53
|
+
reviewing a freshly-cloned, not-yet-trusted repository (see `TERMS.md` for
|
|
54
|
+
why: a malicious repo can't ship a config that disables its own scan).
|
|
55
|
+
|
|
56
|
+
## Removing a repository CodeVet cloned and kept
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
codevet clean ./some-repo-you-kept
|
|
60
|
+
codevet clean ./some-repo-you-kept --yes # skip the confirmation prompt
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Checks for a marker CodeVet writes when it persists a clone, so you get a
|
|
64
|
+
clear warning if you point it at a folder it didn't actually create.
|
|
65
|
+
Refuses outright on anything that resolves to a root or home directory.
|
|
66
|
+
|
|
67
|
+
## Fixing flagged dependencies
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
codevet fix # safe upgrade — only within your existing semver ranges
|
|
71
|
+
codevet fix --force # allow major-version upgrades (may include breaking changes)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
This runs the real `npm audit fix` under the hood. If a package is pinned
|
|
75
|
+
to an exact version with no `^`/`~`, the safe mode often can't touch it —
|
|
76
|
+
`--force` is what breaks out of that, at the cost of possibly needing code
|
|
77
|
+
changes afterward.
|
|
78
|
+
|
|
79
|
+
## Removing a specific flagged dependency entirely
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
codevet remove-dependency axios
|
|
83
|
+
codevet remove-dependency axios --yes # skip the confirmation prompt
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**This is different from `fix`.** It uninstalls the package outright — use
|
|
87
|
+
this only when you're sure the flagged package isn't actually used
|
|
88
|
+
anywhere in your code, not as a shortcut around fixing something you
|
|
89
|
+
depend on.
|
|
90
|
+
|
|
91
|
+
## Getting more detail on any command
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
codevet --help
|
|
95
|
+
codevet scan --help
|
|
96
|
+
codevet config --help
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Running automatically on every PR (GitHub Action)
|
|
100
|
+
|
|
101
|
+
Add this to `.github/workflows/codevet.yml` in your repo:
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
name: CodeVet
|
|
105
|
+
on: [pull_request]
|
|
106
|
+
jobs:
|
|
107
|
+
scan:
|
|
108
|
+
runs-on: ubuntu-latest
|
|
109
|
+
steps:
|
|
110
|
+
- uses: actions/checkout@v4
|
|
111
|
+
- uses: codevet/codevet@v1
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
This runs all four checks (secrets, dependencies, hygiene, personal data
|
|
115
|
+
flow) on every PR and posts the results as a comment directly on the PR —
|
|
116
|
+
no separate dashboard, no account. By default the check fails if any
|
|
117
|
+
secret or high/critical dependency/data-flow finding is present; set
|
|
118
|
+
`fail-on-high-risk: "false"` in the action's `with:` block if you want it
|
|
119
|
+
advisory-only instead.
|
|
120
|
+
|
|
121
|
+
## Personal data flow scanning (via bearer)
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
codevet scan --no-data-flow # skip this check for this run only
|
|
125
|
+
codevet config disable data-flow
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Catches things pattern-based scanning can't — like logging a password or
|
|
129
|
+
SSN, or sending PII to a third-party endpoint — by tracing where sensitive
|
|
130
|
+
values actually flow through your code, not just matching text patterns.
|
|
131
|
+
|
|
132
|
+
**Platform note:** bearer has no native Windows build. On Windows,
|
|
133
|
+
CodeVet's other three checks (secrets, dependencies, hygiene) work
|
|
134
|
+
normally, but this specific check is unavailable — you'll see a clear
|
|
135
|
+
message explaining why rather than a silent gap. WSL is a workaround if
|
|
136
|
+
you need this check on Windows.
|
|
137
|
+
|
|
138
|
+
## A known limitation: pnpm-managed projects
|
|
139
|
+
|
|
140
|
+
Dependency scanning is skipped (not failed) on projects using pnpm
|
|
141
|
+
(detected via `pnpm-lock.yaml` or `node_modules/.pnpm`). This isn't a
|
|
142
|
+
CodeVet limitation — it's a real, confirmed bug in npm itself: npm's own
|
|
143
|
+
dependency resolver crashes with an internal error when it encounters
|
|
144
|
+
pnpm's symlink structure in `node_modules`. Run `pnpm audit` directly for
|
|
145
|
+
these projects; secrets, hygiene, and data-flow checks are unaffected.
|
|
146
|
+
|
|
147
|
+
## Machine-readable output (for CI/tooling)
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
codevet scan --json report.json # also writes a JSON report alongside the normal output
|
|
151
|
+
codevet scan --fail-on-high-risk # exits with a non-zero code if anything serious is found
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Installing into a pnpm or Yarn workspace
|
|
155
|
+
|
|
156
|
+
Don't run `npm install codevet-cli` (or `npm i codevet-cli`) inside a pnpm-
|
|
157
|
+
or Yarn-managed monorepo — npm's own dependency resolver can crash trying
|
|
158
|
+
to interpret pnpm's symlinked `node_modules` structure (a real, confirmed
|
|
159
|
+
npm bug, not something CodeVet causes). Use `npx` instead, which doesn't
|
|
160
|
+
touch the workspace's dependency tree at all:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
npx codevet-cli scan .
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
If you want CodeVet available as an actual dev dependency in a pnpm
|
|
167
|
+
workspace, use pnpm itself to install it: `pnpm add -D codevet-cli`.
|
|
168
|
+
|
|
169
|
+
## Something not working?
|
|
170
|
+
|
|
171
|
+
Check `TROUBLESHOOTING.md` if it exists in this repo, or open an issue —
|
|
172
|
+
unless it's a security vulnerability, in which case see `SECURITY.md`
|
|
173
|
+
instead of a public issue.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# SECURITY-CHECKLIST.md — Severity-annotated
|
|
2
|
+
|
|
3
|
+
**CRITICAL** = fix before anyone else touches this code. **HIGH** = fix before
|
|
4
|
+
launch. **MODERATE** = real, but rarely the sole cause of an incident —
|
|
5
|
+
schedule it, don't panic. **LOW** = worth doing, not urgent.
|
|
6
|
+
|
|
7
|
+
Items marked **[CodeVet]** are checked automatically by `codevet scan`.
|
|
8
|
+
Everything else stays a human judgment call — no scanner replaces review
|
|
9
|
+
for business logic, authorization correctness, or the legal/business
|
|
10
|
+
items at the bottom.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Security (highest priority)
|
|
15
|
+
|
|
16
|
+
| Item | Severity | Automated? |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| No hardcoded API keys/secrets/credentials — use env vars | **CRITICAL** | **[CodeVet]** gitleaks |
|
|
19
|
+
| `.env` not gitignored (real values could reach git history) | **CRITICAL** | **[CodeVet]** |
|
|
20
|
+
| Supabase: Row Level Security enabled on every table | **CRITICAL** | **[CodeVet]** (static check — verify in dashboard too) |
|
|
21
|
+
| Supabase: service role key never in client-side code | **CRITICAL** | **[CodeVet]** gitleaks |
|
|
22
|
+
| Exposed `.env` files, `.git` folders, or admin routes in production | HIGH | Manual — deployment config |
|
|
23
|
+
| SQL injection / XSS / CSRF protection in place | HIGH | Manual — needs code review |
|
|
24
|
+
| No rate limiting on auth routes (login/signup/reset) | HIGH | **[CodeVet]** |
|
|
25
|
+
| CORS wide open (`*`) | HIGH | **[CodeVet]** (pattern match — confirm runtime config) |
|
|
26
|
+
| Error responses leak stack traces / internal details | HIGH | **[CodeVet]** |
|
|
27
|
+
| Passwords hashed (bcrypt/argon2), never plaintext | HIGH | Manual — CodeVet can't verify runtime behavior |
|
|
28
|
+
| Auth flows tested: session expiry, token refresh, RBAC | HIGH | Manual |
|
|
29
|
+
| Dependencies scanned for known vulnerabilities | HIGH | **[CodeVet]** npm audit |
|
|
30
|
+
| No security headers configured (helmet) | MODERATE | **[CodeVet]** |
|
|
31
|
+
| No schema validation library detected | MODERATE | **[CodeVet]** (false-positive-prone — hand-written validation is invisible to this check) |
|
|
32
|
+
|
|
33
|
+
## Code & architecture
|
|
34
|
+
|
|
35
|
+
| Item | Severity | Automated? |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| Every API route checks who's calling (auth check present) | HIGH | Manual — AI-generated routes often skip this |
|
|
38
|
+
| Test accounts / seed data / debug pages removed before launch | HIGH | Manual |
|
|
39
|
+
| Error handling doesn't leak internals to users | HIGH | **[CodeVet]** (same check as above) |
|
|
40
|
+
| No leftover `console.log`s, debug routes, or test data | LOW | Manual |
|
|
41
|
+
| Environment configs separated (dev/staging/prod) | MODERATE | Manual |
|
|
42
|
+
| Remove unused code, commented-out blocks, dead dependencies | LOW | Manual |
|
|
43
|
+
|
|
44
|
+
## Data & backend
|
|
45
|
+
|
|
46
|
+
| Item | Severity | Automated? |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| Input validation on the server (never trust the client) | HIGH | Manual + **[CodeVet]** validation-library check |
|
|
49
|
+
| Rate limiting on anything that costs money (AI calls, email, login) | HIGH | Partial — **[CodeVet]** checks auth routes; other cost-bearing endpoints need manual review |
|
|
50
|
+
| Database backups configured and tested (can you actually restore?) | HIGH | Manual |
|
|
51
|
+
| Migrations are clean and reversible | MODERATE | Manual |
|
|
52
|
+
|
|
53
|
+
## Deployment & ops
|
|
54
|
+
|
|
55
|
+
| Item | Severity | Automated? |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| Plan for key rotation if one leaks | HIGH | Manual — have the runbook ready before you need it |
|
|
58
|
+
| SSL/HTTPS enforced everywhere | HIGH | Manual — deployment/infra config |
|
|
59
|
+
| CI/CD or a documented, repeatable deploy process | MODERATE | Manual |
|
|
60
|
+
| Monitoring/error tracking set up (Sentry, etc.) | MODERATE | Manual |
|
|
61
|
+
|
|
62
|
+
## Legal & business
|
|
63
|
+
|
|
64
|
+
**Not automatable — CodeVet has no visibility into contracts or business
|
|
65
|
+
terms.** Still worth having a checklist for, since these cause real pain
|
|
66
|
+
when skipped:
|
|
67
|
+
|
|
68
|
+
| Item | Severity |
|
|
69
|
+
|---|---|
|
|
70
|
+
| Written contract: scope, deliverables, payment, revision limits | HIGH |
|
|
71
|
+
| IP ownership clause — who owns the code once paid? | HIGH |
|
|
72
|
+
| Privacy policy / terms of service if collecting user data | HIGH |
|
|
73
|
+
| DPDP Act / GDPR / CCPA compliance if applicable to your user base | HIGH |
|
|
74
|
+
| Clear statement of what's *not* included (maintenance, hosting, fees) | MODERATE |
|
|
75
|
+
| Handover docs: run locally, deploy, env vars, admin access | MODERATE |
|
|
76
|
+
|
|
77
|
+
## Handover checklist
|
|
78
|
+
|
|
79
|
+
| Item | Severity |
|
|
80
|
+
|---|---|
|
|
81
|
+
| All credentials transferred securely, never over Slack/email plaintext | HIGH |
|
|
82
|
+
| README with setup instructions | MODERATE |
|
|
83
|
+
| You retain no unnecessary access after the project ends | HIGH |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## The honest read
|
|
88
|
+
|
|
89
|
+
If you only have time for the CRITICAL and HIGH rows: that's a legitimate
|
|
90
|
+
launch bar for a small project. MODERATE items are real but rarely the
|
|
91
|
+
single cause of an incident — schedule them, don't block launch on them.
|
|
92
|
+
The two things people skip most and regret most: **security hardening**
|
|
93
|
+
(the CRITICAL/HIGH rows above) and **the contract** (Legal & business
|
|
94
|
+
section) — if you only fix two categories, make it those.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codevet-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Vet your code before it ships \u2014 a free, open-source security co-pilot that checks for leaked secrets, vulnerable dependencies, missing security middleware, and personal data flow, with real working fixes shown inline.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc",
|
|
@@ -40,7 +40,19 @@
|
|
|
40
40
|
"files": [
|
|
41
41
|
"dist",
|
|
42
42
|
".gitleaks.toml",
|
|
43
|
-
"scripts"
|
|
43
|
+
"scripts",
|
|
44
|
+
"AGENTS.md",
|
|
45
|
+
"CLAUDE.md",
|
|
46
|
+
".claude",
|
|
47
|
+
".cursor",
|
|
48
|
+
".opencode",
|
|
49
|
+
"docs",
|
|
50
|
+
"PRIVACY.md",
|
|
51
|
+
"TERMS.md",
|
|
52
|
+
"SECURITY.md",
|
|
53
|
+
"INFO.md",
|
|
54
|
+
"CODE_OF_CONDUCT.md",
|
|
55
|
+
"CONTRIBUTING.md"
|
|
44
56
|
],
|
|
45
57
|
"repository": {
|
|
46
58
|
"type": "git",
|