Skip to content

Commit 68b3bb1

Browse files
authored
Merge pull request #144 from salesforcecli/ew/vuln-check
W-19595600: check for vuln packages
2 parents fc9dec9 + 7f020e5 commit 68b3bb1

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/npmPublish.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ on:
5555
required: false
5656
default: yarn
5757
type: string
58+
vulnerabilityCheck:
59+
description: if true, checks for known vulnerable package versions
60+
required: false
61+
default: true
62+
type: boolean
5863
jobs:
5964
check-publish:
6065
outputs:
@@ -131,6 +136,66 @@ jobs:
131136
- name: Install dependencies with npm
132137
if: inputs.packageManager == 'npm'
133138
uses: salesforcecli/github-workflows/.github/actions/npmInstallWithRetries@main
139+
- name: Vulnerability check
140+
if: inputs.vulnerabilityCheck
141+
# Temporary check for known vulnerable packages from the following supply chain attack:
142+
# https://www.sonatype.com/blog/npm-chalk-and-debug-packages-hit-in-software-supply-chain-attack
143+
# Last updated 10:33 a.m. ET on September 9, 2025
144+
run: |
145+
vulns=(
146+
"@coveops/abi@2.0.1"
147+
"@duckdb/duckdb-wasm@1.29.2"
148+
"@duckdb/node-api@1.3.3"
149+
"@duckdb/node-bindings@1.3.3"
150+
"ansi-regex@6.2.1"
151+
"ansi-styles@6.2.2"
152+
"backslash@0.2.1"
153+
"chalk@5.6.1"
154+
"chalk-template@1.1.1"
155+
"color@5.0.1"
156+
"color-convert@3.1.1"
157+
"color-name@2.0.1"
158+
"color-string@2.1.1"
159+
"debug@4.4.2"
160+
"duckdb@1.3.3"
161+
"error-ex@1.3.3"
162+
"has-ansi@6.0.1"
163+
"is-arrayish@0.3.3"
164+
"prebid@10.9.2"
165+
"prebid-universal-creative@1.17.3"
166+
"prebid.js@10.9.2"
167+
"proto-tinker-wc@0.1.87"
168+
"simple-swizzle@0.2.3"
169+
"slice-ansi@7.1.1"
170+
"strip-ansi@7.1.1"
171+
"supports-color@10.2.1"
172+
"supports-hyperlinks@4.1.1"
173+
"wrap-ansi@9.0.1"
174+
)
175+
176+
for vuln in "${vulns[@]}"; do
177+
if [[ -n $(npm ls --depth=99 --parseable "$vuln") ]]; then
178+
echo "VULNERABILITY FOUND: $vuln"
179+
exit 1
180+
else
181+
echo "Known vulnerability not found: $vuln"
182+
fi
183+
done
184+
185+
# Known string from the exploit
186+
# https://github.com/chalk/chalk/issues/656#issuecomment-3266880534
187+
strings=(
188+
"_0x112fa8"
189+
)
190+
191+
for str in "${strings[@]}"; do
192+
if grep -r "$str" --include='*.js' .; then
193+
echo "VULNERABILITY FOUND: string '$str' found in js files"
194+
exit 1
195+
else
196+
echo "String '$str' not found in js files"
197+
fi
198+
done
134199
- run: $INPUTS_PACKAGE_MANAGER run build
135200
- run: npm install -g @salesforce/plugin-release-management
136201
- name: NPM Release

0 commit comments

Comments
 (0)