T08 · Insecure Dependencies
- Location
SKILL.md:236- Finding
Unrestricted npm Dependency Installation During RPM Builds
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 70 and 236
Vulnerability Type: Unsafe third-party dependency installation and lifecycle-script execution
Risk Level: MediumVulnerable Code
At line 70, the build-system table recommends unrestricted dependency installation:
markdown | Node.js | `%autosetup -p1 -n package` | `npm install` |手动安装|At line 236, the Node.js RPM template executes the same operation during the build:
spec ### Node.js ```spec BuildRequires: nodejs npm %prep: %autosetup -p1 -n package %build: npm install --production=false && npm run build %install: mkdir -p %{buildroot}%{_datadir}/%{name} && cp -r . %{buildroot}%{_datadir}/%{name}/text ### Technical Analysis The recommended `%build` command invokes `npm install --production=false` without requiring: - A reviewed and committed lockfile. - Deterministic installation through `npm ci`. - Disabled npm lifecycle scripts. - An approved or pinned package registry. - Dependency integrity or provenance verification. - Isolation in a disposable, unprivileged build environment. `npm install` can resolve mutable third-party dependency versions when dependency ranges are present. It can also execute lifecycle hooks such as `preinstall`, `install`, and `postinstall`. Those hooks execute with the permissions and environment of the RPM build user. Consequently, a malicious or compromised package selected during dependency resolution can execute commands before the expected `npm run build` step. This is an unsafe supply-chain pattern even though the Skill itself does not contain an embedded malicious payload. ### Attack Path 1. A Node.js project being packaged declares a dependency using a mutable version range, references an unsafe package source, or lacks a trusted lockfile. 2. An attacker compromises a dependency, publishes a malicious version that satisfies the range, or exploits dependency ...[truncated 1469 chars]- Remediation
View remediation
Remediation Suggestions
Replace unrestricted installation with a deterministic, reviewed process:
spec %build npm ci --ignore-scripts --offline npm run buildApply the following controls:
- Require a committed, reviewed
package-lock.jsonand usenpm cirather thannpm install. - Use
--ignore-scriptsby default to prevent dependency lifecycle hooks from executing automatically. - If lifecycle scripts are essential, review the relevant packages and scripts explicitly, then allow only the minimum required execution.
- Pin and validate the expected npm registry through controlled build configuration.
- Verify lockfile integrity metadata and dependency provenance before building.
- Prefer pre-fetched, audited dependencies and disable network access during the RPM build where practical.
- Run builds in disposable containers or mock environments under an unprivileged account.
- Keep package-signing and publication credentials outside the dependency installation environment.
- Audit the final build root and RPM contents for unexpected files or modifications before signing and publishing.
- Update both the build-system summary at line 70 and the Node.js template at line 236 so users are not directed toward the unsafe command elsewhere in the Skill.
- Require a committed, reviewed
