dependency-radar 0.8.0 → 0.9.0

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/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Dependency Radar
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/dependency-radar.svg)](https://www.npmjs.com/package/dependency-radar)
4
+ [![CI](https://github.com/JosephMaynard/dependency-radar/actions/workflows/ci.yml/badge.svg)](https://github.com/JosephMaynard/dependency-radar/actions/workflows/ci.yml)
5
+ [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/12839/badge)](https://www.bestpractices.dev/projects/12839)
6
+ [![OpenSSF Scorecard](https://img.shields.io/ossf-scorecard/github.com/JosephMaynard/dependency-radar?label=openssf%20scorecard)](https://securityscorecards.dev/viewer/?uri=github.com/JosephMaynard/dependency-radar)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
3
9
  Dependency Radar inspects your Node.js dependency graph and makes structural risk visible.
4
10
 
5
11
  Unlike basic audit tools, it builds the graph from lockfiles, understands PNPM workspaces, validates declared vs inferred licences, and highlights structural risks before they become production problems.
@@ -14,16 +20,55 @@ npx dependency-radar
14
20
 
15
21
  This runs a scan against the current project and writes a self-contained `dependency-radar.html` report you can open locally, share with teammates, or attach to tickets and documentation.
16
22
 
23
+ You can see a [Dependency Radar example report](https://www.dependency-radar.com/examples/dependency-radar.html).
24
+
17
25
  ---
18
26
 
19
27
  ![Dependency Radar – dependency list view](./docs/screenshot-01.jpg)
20
- *List view: search, filter, and drill into every dependency licence, vulnerabilities, install risk, depth, origins, and more.*
28
+ *List view: search, filter, and drill into every dependency, licence, vulnerabilities, install risk, depth, origins, and more.*
29
+
30
+ ![Dependency Radar – expanded dependency](./docs/screenshot-03.jpg)
31
+ *Expanded dependency view: scan the key risk signals first, then drill into status, scope, origins, install behaviour, licence, vulnerabilities, and upgrade blockers.*
21
32
 
22
33
  ![Dependency Radar – interactive dependency graph view](./docs/screenshot-02.jpg)
23
34
  *Graph view: explore the full dependency tree visually, with direct, dev, and transitive relationships at a glance.*
24
35
 
25
36
  ---
26
37
 
38
+ ## Before you run a random `npx` command
39
+
40
+ It is reasonable to be cautious about running a new CLI tool inside your project.
41
+
42
+ Dependency Radar is designed to be inspectable and low-friction to evaluate:
43
+
44
+ - the CLI has no runtime npm dependencies
45
+ - scans run on your machine
46
+ - Dependency Radar does not modify your `package.json`, lockfile, or installed dependencies
47
+ - Dependency Radar does not upload your source code or generated reports during a normal CLI scan
48
+ - reports are written to disk as local files
49
+ - the only default network activity is package-manager-backed audit and outdated checks, which query the configured package registry for dependency metadata
50
+ - use `--offline` for a no-registry-call scan
51
+
52
+ You can inspect the source on GitHub, view the npm package metadata, or start with an offline scan:
53
+
54
+ ```bash
55
+ npx dependency-radar --offline
56
+ ```
57
+
58
+ Security issues should be reported privately; see [SECURITY.md](./SECURITY.md).
59
+
60
+ ## What the CLI accesses
61
+
62
+ | Area | What happens |
63
+ |---|---|
64
+ | Project files | Reads package manifests, lockfiles, and installed dependency metadata |
65
+ | `node_modules` | Reads package metadata and selected files for dependency analysis |
66
+ | Output files | Writes reports/SBOMs only where requested |
67
+ | Network | Runs package-manager audit/outdated checks by default, which query the configured package registry for dependency metadata |
68
+ | Offline mode | `--offline` skips audit, outdated, signature verification, and targeted registry enrichment checks |
69
+ | Source code upload | No source code or generated reports are uploaded during a normal CLI scan |
70
+ | Project mutation | Dependency Radar does not install, update, remove, or rewrite dependencies |
71
+
27
72
  ## What you get
28
73
 
29
74
  - **Vulnerability scanning** — runs `npm audit` / `pnpm audit` / `yarn audit` and surfaces advisories with severity, fix availability, and reachability heuristics
@@ -33,11 +78,14 @@ This runs a scan against the current project and writes a self-contained `depend
33
78
  - **Import usage heuristics** — classifies each dependency's runtime impact (`runtime`, `build`, `testing`, `tooling`, `mixed`) based on where it's imported in your source
34
79
  - **Full transitive tree** — shows depth, parent relationships, fan-in/fan-out, and dependency origins
35
80
  - **Workspace support** — works across npm, pnpm, and Yarn workspaces
36
- - **CI-friendly** — `--fail-on` flag lets you enforce licence and vulnerability policies in pipelines
81
+ - **CI-friendly** — `--fail-on` flag lets you enforce licence, vulnerability, and compare-mode dependency change policies in pipelines
37
82
  - **Review-friendly outputs** — emit JSON, SARIF, CycloneDX SBOM, or SPDX SBOM artifacts from the same local scan
38
83
  - **Change comparison** — compare a fresh scan with a previous `dependency-radar.json` to see added dependencies, removed dependencies, version changes, and new findings
39
- - **Lockfile supply-chain signals** — flags git/local/tarball sources, missing integrity, unexpected registry hosts, and optional npm signature/provenance verification
40
- - **Completely offline-capable** — use `--offline` to skip registry calls; all package metadata is read from local `node_modules`
84
+ - **Source review signals** — flags git, local file, and non-registry tarball dependency sources
85
+ - **Lockfile integrity signals** — flags missing integrity data and unexpected registry hosts
86
+ - **Local execution review signals** — flags install-time behavior and bounded local execution capability signals
87
+ - **Packaging and registry review signals** — flags packaging cues, optional npm signature/provenance results, and limited registry-metadata heuristics applied only to packages already flagged as suspicious
88
+ - **Offline-capable** — use `--offline` to skip registry calls; dependency metadata is still read from local `node_modules`
41
89
  - **Single self-contained HTML file** — no server needed; open it locally, attach it to a ticket, or share it with your team
42
90
 
43
91
  ## When should you use this?
@@ -50,10 +98,13 @@ This runs a scan against the current project and writes a self-contained `depend
50
98
 
51
99
  ## What it is not
52
100
 
53
- - Not a CI service or hosted scanning platform
54
- - Not a replacement for dedicated security scanners
55
- - Not a bundler or build tool
101
+ Dependency Radar is a review and triage tool. It makes dependency risk easier to see, but it does not make security decisions for you.
102
+
103
+ - Not a hosted scanning platform or CI service
104
+ - Not a malware detector or guarantee that a package is safe
105
+ - Not a replacement for dedicated security scanners, manual review, or threat modelling
56
106
  - Not a dependency updater
107
+ - Not a bundler, package manager, or build tool
57
108
 
58
109
  ## Why this exists
59
110
 
@@ -70,7 +121,7 @@ Dependency Radar exists to make those hidden signals visible in one place, from
70
121
 
71
122
  ## Need to share findings with leadership?
72
123
 
73
- The CLI tool is free and fully functional forever.
124
+ The CLI tool is free and fully functional forever. It does not require an account or upload during normal use.
74
125
 
75
126
  If you need to communicate dependency risk beyond engineering (CTO, compliance, security, clients, or investors), the optional premium service adds executive summaries, presentation-ready reports, and deeper enrichment signals that are not available in the standard local scan.
76
127
 
@@ -78,6 +129,8 @@ These include ecosystem and maintenance insights such as whether a dependency is
78
129
 
79
130
  See https://dependency-radar.com for details.
80
131
 
132
+ The free CLI does not require an account or upload. The optional premium service is separate and only applies if you choose to use it.
133
+
81
134
  ---
82
135
 
83
136
  ## Usage
@@ -102,7 +155,7 @@ The `scan` command is the default and can also be run explicitly as `npx depende
102
155
  | `--target-node <major>` | Add Node major compatibility findings based on local `engines.node` metadata |
103
156
  | `--audit-signatures` | Run `npm audit signatures` for registry signature/provenance verification (opt-in; skipped with `--offline`) |
104
157
  | `--schema` | Print the current Dependency Radar JSON schema, or write it with `--out <path>` |
105
- | `--offline` | Skip `npm audit` and `npm outdated` (useful for offline/air-gapped scans) |
158
+ | `--offline` | Skip registry lookups: `npm audit`, `npm outdated`, signature checks, and targeted registry enrichment |
106
159
  | `--json` | Output JSON instead of HTML (`dependency-radar.json`) |
107
160
  | `--timestamp` | Add a local timestamp to generated report filenames (`dependency-radar.YYYY-MM-DD_HH-mm-ss.html`) |
108
161
  | `--no-report` | Run analysis only; no HTML/JSON output written |
@@ -174,6 +227,38 @@ npx dependency-radar compare ./dependency-radar-before.json --json --offline
174
227
 
175
228
  The comparison highlights added dependencies, removed dependencies, one-version package changes, new findings, and resolved findings. This is useful in pull requests and release checks.
176
229
 
230
+ Compare mode can also fail CI when a dependency change introduces a new risky trait compared with a committed JSON baseline:
231
+
232
+ ```bash
233
+ npx dependency-radar compare ./dependency-radar-baseline.json --offline --fail-on new-supply-chain-signal,new-install-script,new-child-process
234
+ ```
235
+
236
+ This is intentionally not a generic "any dependency changed" gate. It is a review guardrail for targeted local signals such as a newly introduced install script, native build surface, CLI executable, direct dependency, local execution capability signal, packaging signal, or lockfile supply-chain source signal. These signals mean "review this change"; they are not malware verdicts.
237
+
238
+ Local execution capability signals are derived by bounded static inspection of lifecycle script commands, referenced install files, package `bin` targets, entry files, and a small capped subset of text-like package source files. Dependency Radar currently reports signals such as child process APIs, network access references, environment access, home directory access, SSH-related references, and obfuscation-like code shape. Scanning is capped by file count and bytes per file so large packages do not become expensive to inspect.
239
+
240
+ Packaging signals are local metadata/content cues such as declared bundled dependencies or an embedded `npm-shrinkwrap.json`. They are review aids for unusual packaging patterns, not proof of compromise.
241
+
242
+ ### Targeted registry enrichment for suspicious packages
243
+
244
+ Dependency Radar can perform a small number of targeted npm registry metadata lookups for packages that already show local review signals, such as install hooks, native bindings, executable bins, supply-chain source signals, or suspicious execution/packaging signals.
245
+
246
+ This enrichment is bounded and selective:
247
+ - it does not query every dependency
248
+ - it is capped to 10 suspicious package names per scan
249
+ - it is skipped when `--offline` is used
250
+
251
+ When metadata is available, Dependency Radar may derive additional review signals such as:
252
+ - recently published package
253
+ - recently published installed version
254
+ - low release history
255
+ - package reactivated after a long dormant period
256
+ - recent patch activity on an older major version line
257
+
258
+ These are heuristic review signals, not proof that a package is malicious or compromised.
259
+
260
+ These signals can appear in the report, JSON output, compare mode, and CI fail rules when supported by the current scan and baseline data.
261
+
177
262
  ### CI policy enforcement (`--fail-on`)
178
263
 
179
264
  ```
@@ -192,8 +277,44 @@ Supported rules:
192
277
  | `unknown-licence` | Fail if at least one dependency has neither declared nor inferred licence data |
193
278
  | `supply-chain-source` | Fail if lockfile source signals detect git/local/tarball sources, missing integrity, or unexpected registry hosts |
194
279
 
280
+ The following rules are evaluated only by `compare <previous dependency-radar.json>` and use the previous JSON report as the baseline:
281
+
282
+ | Rule | Description |
283
+ |---|---|
284
+ | `new-supply-chain-signal` | Fail if the current scan has a lockfile supply-chain signal that was not present in the baseline for the same package, or was not present at all when the signal is not package-specific |
285
+ | `new-install-script` | Fail if a dependency now exposes install lifecycle hooks and the baseline did not show install hooks for that package |
286
+ | `new-native-binding` | Fail if a dependency now exposes native build or binary surface and the baseline did not show native surface for that package |
287
+ | `new-bin` | Fail if a dependency now declares a package `bin` executable and the baseline did not show a `bin` for that package |
288
+ | `new-direct-dependency` | Fail if a package is now direct and was not direct in the baseline |
289
+ | `new-child-process` | Fail if a dependency newly shows local child process API usage |
290
+ | `new-network-access` | Fail if a dependency newly shows local network access references |
291
+ | `new-env-access` | Fail if a dependency newly shows local environment variable access |
292
+ | `new-home-access` | Fail if a dependency newly shows local home directory access |
293
+ | `new-ssh-usage` | Fail if a dependency newly shows SSH-related path, command, or environment references |
294
+ | `new-obfuscation-signal` | Fail if a dependency newly shows an obfuscation-like local code shape |
295
+ | `new-bundled-dependencies` | Fail if a dependency newly declares bundled dependencies |
296
+ | `new-shrinkwrap` | Fail if a dependency newly contains an embedded `npm-shrinkwrap.json` |
297
+ | `new-recent-package` | Fail if a dependency newly shows the `recent-package` registry review signal |
298
+ | `new-recent-version` | Fail if a dependency newly shows the `recent-version` registry review signal |
299
+ | `new-low-release-history` | Fail if a dependency newly shows the `low-release-history` registry review signal |
300
+ | `new-reactivated-package` | Fail if a dependency newly shows the `reactivated-package` registry review signal |
301
+ | `new-old-major-patch` | Fail if a dependency newly shows the `old-major-new-patch` registry review signal |
302
+
195
303
  When rules are violated, Dependency Radar prints `✖ Policy violations detected:` and exits `1`. Unknown rules also exit `1` with a clear error message.
196
304
 
305
+ For compare-mode delta rules, the failure output includes the package and the specific change, for example:
306
+
307
+ ```text
308
+ - 1 new install script surface
309
+ - lodash@4.17.21 introduced install hooks: postinstall
310
+ - 1 new execution signal: child-process
311
+ - foo@1.2.3 introduced execution signal: child-process
312
+ - 1 new registry risk signal: recent-version
313
+ - bar@4.5.6 introduced registry risk signal: recent-version
314
+ ```
315
+
316
+ To use this in CI, commit a known-good JSON report, regenerate it intentionally when reviewed dependency changes are accepted, and compare pull requests against that file.
317
+
197
318
  ### Example: open the generated report using the system default:
198
319
 
199
320
  ```bash
@@ -337,6 +458,7 @@ When you run `npx dependency-radar` (or `dependency-radar scan`), the CLI execut
337
458
  - Source import graph (static import/require parsing in `src/` or project root)
338
459
  - Lockfile supply-chain source signals
339
460
  - Optional npm registry signature/provenance verification (`--audit-signatures`)
461
+ - Targeted npm registry metadata for up to 10 packages that already show local or supply-chain review signals (skipped with `--offline`)
340
462
  6. Normalize outputs into one internal shape and merge workspace package results.
341
463
  - PNPM lock/CLI dependency trees are filtered to installed-only packages (non-installed optional/platform variants are dropped)
342
464
  7. Resolve and crawl installed package directories in `node_modules` to collect local metadata:
@@ -346,10 +468,10 @@ When you run `npx dependency-radar` (or `dependency-radar scan`), the CLI execut
346
468
  - License declaration + `LICENSE` file inference/validation
347
469
  - Advisory summaries and severity/risk rollups
348
470
  - Root-cause/origin and runtime-impact heuristics
349
- - Install-time execution signals
471
+ - Install-time execution signals, local execution capability signals, packaging signals, and targeted registry metadata review signals
350
472
  - Local package metadata (`description`, links, deprecation, TypeScript type availability, installed file count, CLI `bin` presence)
351
473
  9. Build normalized findings from the aggregated dependency model:
352
- - Vulnerabilities, license review items, install-time execution surface, native bindings, deprecated packages, target Node compatibility findings, lockfile source signals, and npm signature/provenance failures
474
+ - Vulnerabilities, license review items, install-time execution surface, local execution capability signals, packaging signals, targeted registry metadata review signals, native bindings, deprecated packages, target Node compatibility findings, lockfile source signals, and npm signature/provenance failures
353
475
  10. Write final output as one of:
354
476
  - `dependency-radar.html` (self-contained report), or
355
477
  - `dependency-radar.json` (raw aggregated model)
@@ -358,13 +480,13 @@ When you run `npx dependency-radar` (or `dependency-radar scan`), the CLI execut
358
480
  - SPDX SBOM (`--format spdx` / `--sbom spdx`)
359
481
  11. Remove `.dependency-radar/` unless `--keep-temp` is set.
360
482
 
361
- The scan is local-first: package metadata is read from `node_modules`; only audit/outdated commands require registry access.
483
+ The scan runs on your machine: package metadata is read from `node_modules`. Audit/outdated commands, optional signature checks, and targeted registry enrichment require registry access and are skipped or disabled with `--offline`.
362
484
 
363
485
  The `explain` command reuses this same pipeline with report writing disabled, then filters the in-memory model down to a single package for terminal output.
364
486
 
365
487
  ### `node_modules` crawling details
366
488
 
367
- - Dependency metadata is read from installed package directories, not from registry documents.
489
+ - Dependency metadata is read from installed package directories. Targeted registry enrichment reads only npm metadata for a capped set of already suspicious packages during online scans.
368
490
  - Package resolution is workspace-aware and PNPM-aware, including `.pnpm` virtual store paths.
369
491
  - License discovery checks common file variants such as `LICENSE`, `LICENCE`, `COPYING`, and `NOTICE` (with or without extensions like `.md`).
370
492
 
@@ -700,8 +822,8 @@ For full details and any future changes, see `src/types.ts`.
700
822
  ## Notes
701
823
 
702
824
  - The target project must have dependencies installed (run `npm install`, `pnpm install`, or `yarn install` first).
703
- - The scan runs on your machine and does not upload your code or dependencies anywhere.
704
- - `npm audit`, `pnpm audit`, `yarn npm audit` and their corresponding `outdated` commands perform registry lookups; use `--offline` for offline-only scans.
825
+ - The scan runs on your machine and does not upload your source code or generated reports during a normal CLI scan.
826
+ - `npm audit`, `pnpm audit`, `yarn npm audit`, corresponding `outdated` commands, optional npm signature checks, and targeted registry enrichment perform registry lookups; use `--offline` for offline-only scans.
705
827
  - On some Yarn Berry setups, `yarn outdated` is not available; the scan continues and marks outdated data as unavailable.
706
828
  - A temporary `.dependency-radar/` folder is created during the scan to store intermediate tool output.
707
829
  - Use `--keep-temp` to retain this folder for debugging; otherwise it is deleted automatically.
@@ -713,6 +835,10 @@ For full details and any future changes, see `src/types.ts`.
713
835
 
714
836
  ## Development
715
837
 
838
+ ### Testing expectations
839
+
840
+ New or changed user-facing functionality should include automated tests where practical. For larger dependency graph, package manager, report output, or supply-chain signal changes, run the relevant fixture tests as well as the unit tests.
841
+
716
842
  ### Setup
717
843
 
718
844
  ```bash
@@ -771,3 +897,38 @@ This opens the report UI in your browser with sample data covering all dependenc
771
897
  - `report-ui/sample-data.json` – Sample data for development
772
898
  - `report-ui/types.ts` – Client-side TypeScript types
773
899
  - `src/report-assets.ts` – Auto-generated file with bundled CSS/JS (do not edit directly)
900
+
901
+ ### Contributing
902
+
903
+ Bug reports and pull requests are welcome via GitHub.
904
+
905
+ For bug reports, please include:
906
+
907
+ - the Dependency Radar version
908
+ - your package manager and version
909
+ - your Node.js version
910
+ - the command you ran
911
+ - what you expected to happen
912
+ - what actually happened
913
+ - any relevant error output
914
+
915
+ Please remove secrets, private package names, or sensitive project details before sharing logs or reports.
916
+
917
+ For pull requests, small focused changes are easiest to review. Before opening a PR, please make sure the project builds and the relevant tests pass:
918
+
919
+ ```bash
920
+ npm run build
921
+ npm run test:unit
922
+ ```
923
+
924
+ For larger dependency graph, package manager, report output, or supply-chain signal changes, also run the relevant fixture tests where practical.
925
+
926
+ Please do not report suspected security vulnerabilities in public issues. See [SECURITY.md](./SECURITY.md) for private reporting guidance.
927
+
928
+
929
+
930
+ ## Releases and changelog
931
+
932
+ Release notes are published through [GitHub Releases](https://github.com/JosephMaynard/dependency-radar/releases), which act as the project changelog.
933
+
934
+ Each release summarises notable changes, fixes, and compatibility notes where relevant.