Skip to content

Commit 477f79a

Browse files
authored
Merge pull request #147 from sonukapoor/feature/issue-146-fix-mode-docs
docs: add --fix guide and Juice Shop auto-fix evidence
2 parents 7641dc2 + 6319acb commit 477f79a

5 files changed

Lines changed: 131 additions & 0 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<a href="#why-offline-mode-matters">Why offline mode matters</a><br/>
3838
<a href="docs/case-studies/owasp-juice-shop.md">OWASP Juice Shop case study</a><br/>
3939
<a href="docs/case-studies/nestjs.md">NestJS case study</a><br/>
40+
<a href="docs/fix-mode.md">Fix mode guide (--fix)</a><br/>
4041
<a href="docs/how-to-read-verbose-output.md">How to read verbose output</a><br/>
4142
<a href="#what-it-looks-like">What it looks like</a><br/>
4243
<a href="#why-this-tool-exists">Why this tool exists</a><br/>
@@ -83,6 +84,7 @@ It is designed to be:
8384

8485
For real-world remediation examples, see the [OWASP Juice Shop case study](docs/case-studies/owasp-juice-shop.md) and the [NestJS case study](docs/case-studies/nestjs.md).
8586
If you are new to verbose mode, use the [How to read verbose output guide](docs/how-to-read-verbose-output.md).
87+
If you want automatic direct remediation, use the [Fix mode guide](docs/fix-mode.md).
8688

8789
## New here? Start here
8890

@@ -179,6 +181,9 @@ cve-lite /path/to/project --min-severity high
179181
# Recommended for CI logs when you want full context
180182
cve-lite /path/to/project --verbose
181183

184+
# Apply validated direct dependency fixes and rescan
185+
cve-lite /path/to/project --fix
186+
182187
# Limit the scan to production dependencies where supported by the lockfile
183188
cve-lite /path/to/project --prod-only
184189

@@ -204,6 +209,29 @@ cve-lite /path/to/project --offline
204209
cve-lite /path/to/project --offline-db /path/to/advisories.db
205210
```
206211

212+
## Auto-fix mode (`--fix`)
213+
214+
`--fix` is designed to speed up remediation without overpromising safety.
215+
216+
In v1, `--fix`:
217+
- applies only direct dependency fixes with a validated lowest known non-vulnerable target
218+
- uses your project’s package manager (`npm install`, `pnpm add`, or `yarn add`)
219+
- rescans automatically after applying fixes
220+
- prints a concise summary of applied fixes, skipped findings, and remaining findings
221+
222+
In v1, `--fix` does not:
223+
- auto-apply transitive overrides/resolutions
224+
- guarantee compatibility with your application code
225+
- perform exploitability or runtime reachability analysis
226+
227+
Example:
228+
229+
```bash
230+
npx cve-lite-cli /path/to/project --fix
231+
```
232+
233+
For output details and interpretation, see [Fix mode guide](docs/fix-mode.md).
234+
207235
## Workflow modes
208236

209237
CVE Lite CLI now supports three clear advisory workflows:
412 KB
Loading

docs/case-studies/owasp-juice-shop.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,44 @@ Terminal snapshots from this run:
4949

5050
![Juice Shop dependency path hints and remaining risk](https://raw.githubusercontent.com/sonukapoor/cve-lite-cli/main/assets/owasp-juice-shop-5.png)
5151

52+
## Auto-fix pass (`--fix`) evidence
53+
54+
After the planning scan, we ran a focused auto-fix pass:
55+
56+
```bash
57+
npx cve-lite-cli . --fix
58+
```
59+
60+
Run outcome:
61+
62+
- applied direct package fixes: `7`
63+
- skipped findings: `5`
64+
- transitive (v1 skip): `3`
65+
- no validated direct target: `2`
66+
- findings before fix: `39`
67+
- findings after fix pass: `39`
68+
- remaining severity mix: critical `3`, high `1`, medium `11`, low `23`, unknown `1`
69+
70+
Applied direct dependency upgrades:
71+
72+
- `jsonwebtoken: 0.1.0 -> 9.0.0`
73+
- `sanitize-html: 1.4.2 -> 2.12.1`
74+
- `multer: 1.4.5-lts.2 -> 2.1.1`
75+
- `express-jwt: 0.1.3 -> 6.0.0`
76+
- `file-type: 16.5.4 -> 21.3.1`
77+
- `js-yaml: 4.0.0 -> 4.1.1`
78+
- `socket.io: 3.1.2 -> 4.6.2`
79+
80+
Why the total finding count can remain unchanged after auto-fix:
81+
82+
- a large share of Juice Shop findings are transitive and still require parent-chain upgrades
83+
- some direct findings have no validated auto-apply target
84+
- duplicate vulnerable packages can still exist in other dependency paths until parent upgrades are applied
85+
86+
Auto-fix terminal snapshot:
87+
88+
![Juice Shop auto-fix summary output](https://raw.githubusercontent.com/sonukapoor/cve-lite-cli/main/assets/owasp-juice-shop-auto-fix.png)
89+
5290
## Copy-and-run remediation output
5391

5492
In this run, CVE Lite CLI generated `6` command groups across `10` packages:

docs/fix-mode.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Fix Mode Guide (`--fix`)
2+
3+
`--fix` is a conservative auto-remediation mode for CVE Lite CLI.
4+
5+
It is intended to reduce manual install-scan-repeat loops while keeping behavior explicit and predictable.
6+
7+
## What `--fix` does in v1
8+
9+
- applies fixes for **direct dependencies only**
10+
- requires a validated **lowest known non-vulnerable version** target
11+
- uses package-manager-native commands:
12+
- `npm install`
13+
- `pnpm add`
14+
- `yarn add`
15+
- rescans automatically after fixes are applied
16+
- prints a concise summary:
17+
- applied fixes
18+
- skipped findings
19+
- findings before/after fix
20+
- remaining severity mix
21+
22+
## What `--fix` does not do in v1
23+
24+
- does not auto-apply transitive override/resolution rules
25+
- does not guarantee compatibility with your codebase
26+
- does not perform exploitability or runtime reachability analysis
27+
28+
## Basic usage
29+
30+
```bash
31+
npx cve-lite-cli /path/to/project --fix
32+
```
33+
34+
## Typical output flow
35+
36+
1. scan starts and loads advisory matches
37+
2. `Applying fixes (--fix)` section begins
38+
3. direct package fixes are applied with progress (for example `Applying direct fix 3/7: npm install pkg@version`)
39+
4. scan reruns automatically
40+
5. concise fix summary is printed
41+
42+
## How to interpret skipped findings
43+
44+
- `Transitive (v1 skip)` means a parent upgrade path may exist, but `--fix` intentionally does not auto-apply it in v1.
45+
- `No validated direct target` means a direct dependency did not have a safe validated target for automatic remediation.
46+
47+
For full diagnostic context, run a separate verbose scan:
48+
49+
```bash
50+
npx cve-lite-cli /path/to/project --verbose
51+
```
52+
53+
## Recommended workflow
54+
55+
1. run `--fix` for fast direct remediation
56+
2. review remaining findings in summary
57+
3. run `--verbose` when you need full parent-path and table-level detail
58+
4. test your project after dependency updates

docs/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<nav>
2929
<a href="#quick-start">Quick Start</a>
3030
<a href="#features">Features</a>
31+
<a href="#fix-mode">Fix Mode</a>
3132
<a href="#workflow">Workflow</a>
3233
<a href="#speed">Speed</a>
3334
<a href="#links">Links</a>
@@ -61,6 +62,7 @@ <h1>Scan. Prioritize. Fix.</h1>
6162
<li>npm, pnpm, Yarn lockfile support</li>
6263
<li>Offline scans with local advisory DB</li>
6364
<li>Copy-and-run direct fix commands</li>
65+
<li>Conservative auto-remediation with `--fix`</li>
6466
</ul>
6567
</div>
6668
<div class="hero-art" aria-hidden="true">
@@ -121,6 +123,10 @@ <h3>Run one-off with npx</h3>
121123
<section class="container" id="features">
122124
<h2>What Makes It Useful</h2>
123125
<div class="grid three">
126+
<article class="card" id="fix-mode">
127+
<h3>Conservative `--fix` mode</h3>
128+
<p>Apply validated direct dependency fixes automatically, then rescan immediately with a concise before/after summary.</p>
129+
</article>
124130
<article class="card">
125131
<h3>Actionable output</h3>
126132
<p>Get summary-first scan results plus copy-and-run fix commands for manifest-declared direct dependencies, with lowest known non-vulnerable targets when data allows.</p>
@@ -196,6 +202,7 @@ <h3>Real-world case studies</h3>
196202
<p class="link-list">
197203
<a href="https://github.com/sonukapoor/cve-lite-cli/blob/main/docs/case-studies/owasp-juice-shop.md">OWASP Juice Shop</a>
198204
<a href="https://github.com/sonukapoor/cve-lite-cli/blob/main/docs/case-studies/nestjs.md">NestJS</a>
205+
<a href="https://github.com/sonukapoor/cve-lite-cli/blob/main/docs/fix-mode.md">Fix mode guide (--fix)</a>
199206
<a href="https://github.com/sonukapoor/cve-lite-cli/blob/main/docs/how-to-read-verbose-output.md">How to read verbose output</a>
200207
</p>
201208
</article>

0 commit comments

Comments
 (0)