Skip to content

security: harden npm install against supply chain attacks#512

Closed
yeelali14 wants to merge 1 commit intodevelopfrom
security/npm-install-hardening
Closed

security: harden npm install against supply chain attacks#512
yeelali14 wants to merge 1 commit intodevelopfrom
security/npm-install-hardening

Conversation

@yeelali14
Copy link
Copy Markdown
Contributor

@yeelali14 yeelali14 commented Apr 4, 2026

Summary

  • Add npm cache clean --force before install to prevent stale/malicious cached tarballs
  • Add --ignore-scripts to block malicious postinstall hooks (e.g. axios supply chain CVE)
  • Remove --silent to make installed package versions visible in logs

Context

In response to the axios npm supply chain compromise (March 31, 2026), where attackers published backdoored versions 1.14.1 and 0.30.4 via a hijacked maintainer account. The malicious versions used a postinstall hook to deploy a cross-platform RAT. --ignore-scripts ensures postinstall hooks are never executed regardless of what version is installed.

Test plan

  • Trigger a gitStream workflow run and verify npm cache clean --force appears in logs
  • Verify added N packages output is visible (no --silent)
  • Verify no postinstall scripts are executed

🤖 Generated with Claude Code

✨ PR Description

Purpose: Harden npm package installation process to prevent supply chain attacks by disabling script execution and clearing cached packages.

Main changes:

  • Added npm cache clean step before dependency installation to prevent poisoned cache exploitation
  • Replaced --silent flag with --ignore-scripts to block malicious postinstall scripts from executing
  • Reordered workflow to clear cache immediately before installing pinned dependency versions

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

- Add npm cache clean --force before install to prevent stale/malicious cached tarballs
- Add --ignore-scripts to block malicious postinstall hooks (e.g. axios CVE)
- Remove --silent to make installed versions visible in logs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed OSS Licenses high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Copy link
Copy Markdown

@linearb linearb bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ PR Review

Agentic review
LGTM

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Review using Guidelines Learn how

@EladKohavi EladKohavi closed this Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants