T08 · Insecure Dependencies
- Location
scripts/build-index.sh:14- Finding
Recommendation to Install an Unpinned Global npm Package
- Content
View full analysis
Vulnerability Details
File Location:
scripts/build-index.sh:14-19
Vulnerability Type: Unpinned global third-party dependency
Risk Level: MediumVulnerable Code
bash build) echo "🔨 Building search index..." echo "⚠️ Feature requires 'qmd' package (install with: npm i -g qmd)" echo " For now, use search.sh for keyword-based search" ;;Technical Analysis
The script recommends installing
qmdglobally without specifying an audited version, package integrity hash, lockfile, or verified publisher. Consequently,npmresolves whichever release is currently associated with that package name.npm packages can execute lifecycle scripts during installation. If the named package, its publisher account, or one of its transitive dependencies is compromised, following this recommendation could execute attacker-controlled code with the privileges of the user running npm. A global installation also places package executables or files in a shared npm prefix, increasing the affected scope compared with a project-local dependency.
The project does not automatically execute this installation command. Exploitation therefore requires a user to follow the displayed recommendation.
Attack Path
- An attacker compromises the
qmdpackage, its publisher account, or a transitive dependency, or causes an unsafe release to become the version resolved by npm. - A user runs the index build operation and sees the recommendation to execute
npm i -g qmd. - The user runs that command without a pinned version or integrity verification.
- npm downloads the currently resolved package and may run its lifecycle scripts.
- Malicious lifecycle code executes as the installing user and may modify files, access that user's data, or install commands into the global npm prefix.
Impact Assessment
Exploit code would ordinarily inherit the privileges of the user invoking npm. It could read or alte ...[truncated 310 chars]
- An attacker compromises the
- Remediation
View remediation
Remediation Suggestions
- Do not recommend an unversioned global installation.
- Identify and document the official package publisher and repository.
- Pin an audited exact version, for example
qmd@X.Y.Z. - Prefer a project-local development dependency recorded in
package.jsonand a committed lockfile. - Verify package integrity and review the package and its transitive dependencies before adoption.
- Avoid elevated installation privileges.
- Where practical, disable lifecycle scripts during installation and explicitly enable only reviewed build steps.
- Document the package's required permissions and provide an uninstall or rollback procedure.
