CASE FILE#1180ERRORFiled 2026-04-13

Controlling Global Dependencies: VS Code Copilot and npm install -g

VS Code Copilot installs a tool globally to avoid setting up a local dev dependency. SSG routes the install to a human approver — global packages persist across all projects and can mutate the system PATH.

Case ID
#1180
Severity
ERROR
Decision
ASK
Agent
VS Code
Category
Infrastructure

Correction note (2026-10-13). The per-call timings and latency figures that appeared in this article had no benchmark behind them and were removed. Sample output in this article is illustrative, not a recorded run. The only published measurement is p50 0.39 ms and p99 1.91 ms (sigmashake-bench daemon-socket run, 2026-06-10, ssg 0.29.156, n=500). Sub-2 ms evaluation is a design target. The local audit log records decisions on a best-effort basis: entries can be dropped if the daemon queue is full, and old rows are deleted at the row caps. It is local, not append-only, and not immutable.

Correction note (2026-10-13). An earlier version of the rule in this article used an env EQUALS "CI" condition. The rule DSL has no env field, so the rule did not load. The rule now has no environment condition.

Describe the task

VS Code Copilot needs a CLI tool for a one-off task. Rather than adding it as a local devDependency, the agent installs it globally:

npm install -g typescript

SSG routes this to a human approver — global packages mutate the system PATH and affect every project on the machine.

# illustrative sample output
[ASK] bash › npm install -g typescript — rule: ask-npm-global
Waiting for human approval...

Give SSG context

SSG evaluates VS Code Copilot's shell commands via the SSG MCP Server integration.

Required context

rule ask-npm-global {
  enabled true
  priority 90
  severity warning
  ASK execution
  IF command CONTAINS "npm install"
  AND command CONTAINS " -g"
  PROMPT "Global npm install requires approval. Prefer local devDependencies."
  MESSAGE "Global npm install requires approval. Prefer local devDependencies."
}

Optional context

Escalate to DENY on CI runners. Rules have no environment field, so install this rule only in the CI checkout:

rule deny-npm-global-ci {
  enabled true
  priority 100
  severity error
  DENY execution
  IF command CONTAINS "npm install -g"
  MESSAGE "Global npm installs are blocked in CI. Use npx or local devDependencies."
}

What SSG does

SSG pauses the tool call and presents it to the human operator in the approval queue. The install only proceeds if explicitly approved — giving you visibility into what's being added to the global package registry.

Ask the agent to use local dependencies

npm install -g was escalated for approval. Consider alternatives:
  npm install --save-dev typescript    # local devDependency
  npx typescript --version            # one-off use without installing
  ./node_modules/.bin/tsc             # use locally installed binary
Global installs persist across projects and can cause version conflicts.

Audit global package installs over time

SSG logs npm install -g attempts, approved or blocked, on a best-effort basis. Use ssg dashboard to review what global tooling your agents are installing and when.

Supply chain risk of global packages

Global packages run with your full user permissions. A malicious or typosquatted global package has access to every file your user account can read. Pair with a typosquatting rule for high-risk package names.

Filed by VS Code
Engine ssg v1 · 2026-04-13
End of case file

Stop reading. Start governing.

Test a rule against any tool call right now. No install required.