T08 · Insecure Dependencies
- Location
references/stack-recipes.md:94- Finding
Execution of an Unpinned Remote Nx Initializer
- Content
View full analysis
Vulnerability Details
File Location:
references/stack-recipes.md:94
Vulnerability Type:T08: Insecure Dependencies
Risk Level: HighVulnerable Code:
markdown 1. Use `npx create-nx-workspace@latest` non-interactively where possible (pass flags for package manager and preset) rather than hand-rolling `nx.json` from scratch — Nx's generators keep the config in the shape Nx's own tooling expects.Technical Analysis
The Skill instructs the Agent to execute
create-nx-workspacethroughnpxusing the mutablelatestdistribution tag. If the package is not already available locally,npxretrieves it and executes its code. The code ultimately executed can therefore change after the Skill has been reviewed.Pinning only a package name and mutable tag does not provide a reproducible or reviewable trust boundary. A compromised npm publisher account, malicious package release, registry compromise, or compromised transitive dependency could introduce arbitrary code. Package initialization logic and npm lifecycle scripts ordinarily execute with the permissions of the Agent's operating-system account.
This network activity is relevant to scaffolding an Nx project, but immediately executing an unpinned remote package exceeds the minimum privilege necessary. The initializer can be pinned, inspected, and separately invoked instead.
Attack Path
- An attacker compromises the
create-nx-workspacerelease process, its publisher account, or a dependency included by a future release. - The attacker publishes malicious code in the version referenced by the mutable
latesttag. - A user requests an Nx-based monorepo.
- Following the recipe, the Agent invokes
npx create-nx-workspace@latest. npxdownloads the current package and associated dependencies from the registry.- The downloaded initializer or lifecycle scripts execute with the Agent user's permissions.
- Malicious code can acce ...[truncated 744 chars]
- An attacker compromises the
- Remediation
View remediation
Remediation Suggestions
- Replace the mutable
@latestreference with an exact, reviewed version, such ascreate-nx-workspace@X.Y.Z. - Resolve and display the proposed version before execution and obtain user confirmation for remote code execution.
- Use the user's configured trusted registry and preserve registry integrity protections.
- Prefer downloading or installing the pinned package first, verifying its provenance and integrity, and invoking its binary as a separate step.
- Use a lockfile where feasible and retain integrity hashes for all resolved dependencies.
- Run scaffolding in a sandbox restricted to the destination directory, with unnecessary credentials removed from the environment and outbound network access limited to required registries.
- Avoid lifecycle scripts where supported, or explicitly review packages that require them before allowing execution.
- Replace the mutable
