Skip to content

ci: use npm ci --ignore-scripts in sps - #2775

Open
aryamohanan wants to merge 4 commits into
mainfrom
test-cve
Open

aryamohanan wants to merge 4 commits into
mainfrom
test-cve

Conversation

@aryamohanan

Copy link
Copy Markdown
Contributor

Replace npm install --foreground-scripts with npm ci --ignore-scripts for dependency installs in the Tekton pipeline.

  • npm ci installs strictly from package-lock.json, preventing a compromised newer version from silently resolving in
  • --ignore-scripts blocks preinstall/postinstall/install lifecycle hooks from running in CI, closing the exact execution vector used by the CHAINDROP/Shai-Hulud npm supply chain worm (Aug 2026)

--foreground-scripts added as part of f558acc

Since we ignore lifecycle scripts during installation, this option is no longer needed, so I removed it.

ref : https://nodejs.org/learn/getting-started/security-best-practices#supply-chain-attacks

https://www.elastic.co/security-labs/shai-hulud-chaindrop-npm-supply-chain#recommendations-how-to-respond-to-the-shai-hulud-compromise

@aryamohanan
aryamohanan marked this pull request as ready for review September 18, 2026 12:01
@aryamohanan
aryamohanan requested a review from a team as a code owner September 18, 2026 12:01
Comment thread .sps/pipeline-config.yaml

cd "$WORKSPACE/$(load_repo app-repo path)"
npm install --loglevel warn --foreground-scripts
npm ci --loglevel warn --ignore-scripts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Using npm ci has no effect in our test env right now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

True, but I think keeping npm ci is good practice here. It ensures deterministic builds by adhering to package-lock.json and is recommended for CI.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah but you did not switch to npm ci for the other parts, because we do run that locally too.
So its a bit inconsistent right now.
You could use isCI helper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants