Skip to content

Find the holes before someone else does. A fast, 100% Rust vulnerability scanner: XSS, SQL injection, leaked secrets, dependency CVEs and AI agent setups.

fix(deps): read pnpm-lock.yaml past its blank lines (#2)

PRAJWAL BHIMRAO RAMTEKE44ceb403cb22
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 41368cb..834896e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
## Unreleased
+- Dependencies: `pnpm-lock.yaml` is read again. A blank line ended the `packages:` section, and
+ pnpm writes one right after it, so every pnpm project reported 0 packages checked.
+
## 1.0.2 (2026-11-23)
- README: GIFs of a real Next.js finding (a password behind `NEXT_PUBLIC_`) and of a clean scan of express.
diff --git a/src/deps.rs b/src/deps.rs
index 2c62c96..74caea2 100644
--- a/src/deps.rs
+++ b/src/deps.rs
@@ -116,6 +116,10 @@ fn pnpm_lock(file: &FileInfo, text: &str) -> Vec<Package> {
let mut out = Vec::new();
let mut in_packages = false;
for (i, line) in text.lines().enumerate() {
+ // pnpm puts a blank line after `packages:` and between entries; it does not end the section.
+ if line.trim().is_empty() {
+ continue;
+ }
if !line.starts_with(' ') {
in_packages = line.starts_with("packages:");
continue;
diff --git a/tests/fixtures/deps/EXPECTED b/tests/fixtures/deps/EXPECTED
index 2a2d11c..4e5f1be 100644
--- a/tests/fixtures/deps/EXPECTED
+++ b/tests/fixtures/deps/EXPECTED
@@ -4,3 +4,4 @@ svc/go.mod:6 dependency.known-vulnerability
rb/Gemfile.lock:4 dependency.known-vulnerability
rs/Cargo.lock:5 dependency.known-vulnerability
php/composer.lock:5 dependency.known-vulnerability
+pnpm/pnpm-lock.yaml:29 dependency.known-vulnerability
diff --git a/tests/fixtures/deps/pnpm/pnpm-lock.yaml b/tests/fixtures/deps/pnpm/pnpm-lock.yaml
new file mode 100644
index 0000000..e86cb10
--- /dev/null
+++ b/tests/fixtures/deps/pnpm/pnpm-lock.yaml
@@ -0,0 +1,38 @@
+lockfileVersion: '9.0'
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false
+
+importers:
+
+ .:
+ dependencies:
+ '@babel/core':
+ specifier: ^7.24.0
+ version: 7.24.0
+ left-pad:
+ specifier: ^1.3.0
+ version: 1.3.0
+ lodash:
+ specifier: ^4.17.20
+ version: 4.17.20
+
+packages:
+
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-fake}
+
+ resolution: {integrity: sha512-fake}
+
+ resolution: {integrity: sha512-fake}
+
+snapshots:
+
+ '@babel/[email protected]': {}
+
+
diff --git a/tests/scan.rs b/tests/scan.rs
index 29a9335..a0a5b63 100644
--- a/tests/scan.rs
+++ b/tests/scan.rs
@@ -98,5 +98,5 @@ fn deps() {
advisories: Some(Box::new(known)),
include_tests: false,
};
- check_with("deps", options, Some(13));
+ check_with("deps", options, Some(16));
}