|
| 1 | +# OWASP Juice Shop Case Study |
| 2 | + |
| 3 | +This case study shows how CVE Lite CLI was used against OWASP [Juice Shop](https://github.com/juice-shop/juice-shop) to identify, prioritize, and reduce dependency risk in a realistic JavaScript application. |
| 4 | + |
| 5 | +It is intentionally practical. The goal is not to claim that every finding was removed, but to show how the tool helped move from an initial scan to a narrower, better-prioritized remediation state. |
| 6 | + |
| 7 | +## Project context |
| 8 | + |
| 9 | +- Project: OWASP Juice Shop |
| 10 | +- Revision used for the scan: `7ae7184dbf84baae9ee1d85be39f793b777ae996` |
| 11 | +- Scan input: `package-lock.json` |
| 12 | +- Scan mode: standard OSV-backed mode with `--verbose --all` |
| 13 | + |
| 14 | +The remediation walkthrough was performed locally against that same Juice Shop revision. Dependency and code changes were applied during the exercise, but they were not committed in the Juice Shop repository. The documented "after" state in this case study refers to the first successful remediation pass that removed the urgent critical and high findings tied to `jsonwebtoken`, `express-jwt`, and `sanitize-html`. |
| 15 | + |
| 16 | +## Commands used |
| 17 | + |
| 18 | +Baseline scan: |
| 19 | + |
| 20 | +```bash |
| 21 | +node /Users/sonukapoor/Projects/cve-lite-cli-v1.0.1/dist/index.js . --verbose --all |
| 22 | +``` |
| 23 | + |
| 24 | +The initial remediation work focused on the highest-priority direct and transitive issues surfaced by CVE Lite CLI: |
| 25 | + |
| 26 | +- `jsonwebtoken` |
| 27 | +- `express-jwt` |
| 28 | +- `sanitize-html` |
| 29 | +- `marsdb` |
| 30 | + |
| 31 | +## Baseline findings |
| 32 | + |
| 33 | +Initial scan summary: |
| 34 | + |
| 35 | +- vulnerable packages: `40` |
| 36 | +- critical: `3` |
| 37 | +- high: `1` |
| 38 | +- medium: `11` |
| 39 | +- low: `24` |
| 40 | +- unknown: `1` |
| 41 | +- unique advisories matched: `79` |
| 42 | + |
| 43 | +Top priority fixes identified by CVE Lite CLI: |
| 44 | + |
| 45 | +- `jsonwebtoken@0.4.0` as a direct critical dependency |
| 46 | +- `marsdb@0.6.11` as a direct critical dependency |
| 47 | +- `express-jwt -> jsonwebtoken@0.1.0` as a transitive critical dependency |
| 48 | +- `sanitize-html -> lodash@2.4.2` as a transitive high dependency |
| 49 | + |
| 50 | +This was a strong example of the tool's intended workflow: surface the most urgent direct issues first, then highlight the transitive parent chains that are worth upgrading next. |
| 51 | + |
| 52 | +## Remediation steps |
| 53 | + |
| 54 | +The following dependency changes were applied locally: |
| 55 | + |
| 56 | +- upgraded `jsonwebtoken` from `0.4.0` to `4.2.2` |
| 57 | +- upgraded `express-jwt` from `0.1.3` to `8.5.1` |
| 58 | +- upgraded `sanitize-html` from `1.4.2` to `2.17.2` |
| 59 | + |
| 60 | +These changes updated the resolved dependency tree and removed several of the highest-priority findings: |
| 61 | + |
| 62 | +- upgrading `express-jwt` also removed transitive `jsonwebtoken@0.1.0` |
| 63 | +- upgrading `sanitize-html` removed the `lodash@2.4.2` high finding |
| 64 | + |
| 65 | +One issue required more than a package version bump. After upgrading `express-jwt`, Juice Shop's code needed an API adjustment in [lib/insecurity.ts](/Users/sonukapoor/Projects/juice-shop/lib/insecurity.ts) because the newer `express-jwt` export shape no longer matched the older callable default import pattern. |
| 66 | + |
| 67 | +## What slowed remediation down |
| 68 | + |
| 69 | +One of the most useful lessons from this walkthrough was that the first remediation attempt appeared to work in `npm ls`, but the CVE Lite CLI scan did not change. |
| 70 | + |
| 71 | +The reason was simple and important: |
| 72 | + |
| 73 | +- the project had `.npmrc` configured with `package-lock=false` |
| 74 | +- `package.json` changed, but `package-lock.json` did not regenerate |
| 75 | +- CVE Lite CLI was correctly reporting the vulnerable versions still pinned in the lockfile |
| 76 | + |
| 77 | +Once the lockfile was regenerated with `package-lock` enabled, the scan reflected the intended dependency changes. |
| 78 | + |
| 79 | +This is exactly the kind of situation where a lockfile-first scanner is useful. It shows the dependency graph the project actually records and ships, not just what a local install tree happens to resolve temporarily. |
| 80 | + |
| 81 | +## After state |
| 82 | + |
| 83 | +After the dependency updates, code adjustment, and lockfile regeneration, the scan summary changed to: |
| 84 | + |
| 85 | +- vulnerable packages: `35` |
| 86 | +- critical: `1` |
| 87 | +- high: `0` |
| 88 | +- medium: `11` |
| 89 | +- low: `21` |
| 90 | +- unknown: `2` |
| 91 | +- unique advisories matched: `55` |
| 92 | + |
| 93 | +Notable improvements: |
| 94 | + |
| 95 | +- critical findings dropped from `3` to `1` |
| 96 | +- high findings dropped from `1` to `0` |
| 97 | +- unique matched advisories dropped from `79` to `55` |
| 98 | +- the urgent `jsonwebtoken` and `sanitize-html` driven findings were removed |
| 99 | + |
| 100 | +Key resolved package state: |
| 101 | + |
| 102 | +- `express-jwt@8.5.1` |
| 103 | +- `jsonwebtoken@4.2.2` |
| 104 | +- `sanitize-html@2.17.2` |
| 105 | +- `marsdb@0.6.11` |
| 106 | + |
| 107 | +## Remaining risk |
| 108 | + |
| 109 | +The most important remaining finding after this pass was: |
| 110 | + |
| 111 | +- `marsdb@0.6.11` as a direct critical dependency |
| 112 | + |
| 113 | +At the time of this walkthrough, `0.6.11` was still the latest published `marsdb` version. The upstream [MarsDB repository](https://github.com/c58/marsdb) is also archived and read-only, which makes this a stronger example of a real remediation limit: some findings can be fixed with normal dependency upgrades, while others may require package replacement, deeper review, or migration away from an unmaintained dependency. |
| 114 | + |
| 115 | +Several medium findings also remained, including: |
| 116 | + |
| 117 | +- `diff@5.0.0` |
| 118 | +- `messageformat@2.3.0` |
| 119 | +- `minimatch` in direct and transitive paths |
| 120 | +- `multer@1.4.5-lts.2` |
| 121 | +- `parseuri@0.0.6` |
| 122 | + |
| 123 | +Those were left intentionally as follow-up work. The purpose of this case study was to show a realistic first remediation pass, not to claim a fully clean result. |
| 124 | + |
| 125 | +## Why this case study stops here |
| 126 | + |
| 127 | +An additional medium-only cleanup pass was attempted after this state, but it introduced more dependency churn than useful signal. Some packages shifted into different vulnerable versions or moved between direct and transitive paths without materially improving the overall story. |
| 128 | + |
| 129 | +That is exactly why this case study uses the earlier post-remediation checkpoint as its final state: it shows a meaningful reduction in urgent risk, keeps the remediation path understandable, and avoids overstating what a single dependency cleanup pass should realistically accomplish. |
| 130 | + |
| 131 | +## What CVE Lite CLI contributed |
| 132 | + |
| 133 | +This walkthrough highlighted a few parts of the tool that were especially useful: |
| 134 | + |
| 135 | +- clear separation of direct and transitive findings |
| 136 | +- parent-chain visibility for transitive remediation work |
| 137 | +- a practical top-priority fix list instead of a flat wall of advisories |
| 138 | +- lockfile-first behavior that exposed stale dependency state when `package-lock` generation was disabled |
| 139 | +- a narrow, developer-oriented workflow that fit well near release-time triage |
| 140 | + |
| 141 | +## Takeaways |
| 142 | + |
| 143 | +- A focused first pass can remove the most urgent dependency risk quickly. |
| 144 | +- Transitive issues often become fixable once the right parent dependency is identified. |
| 145 | +- Lockfile state matters. Updating `package.json` alone is not enough. |
| 146 | +- Some critical findings still have no easy upgrade path and need separate handling. |
| 147 | + |
| 148 | +CVE Lite CLI was useful here not because it claimed complete dependency security, but because it helped turn a large set of findings into an ordered, understandable remediation workflow on a real application. |
0 commit comments