Skip to content

Commit c29db54

Browse files
fix(build): pin npm commands for OpenSSF Scorecard compliance (#181)
# fix(build): pin npm commands for OpenSSF Scorecard compliance ## Description Resolved npm command pinning warnings identified by OpenSSF Scorecard analysis. Replaced non-deterministic `npm install` with `npm ci` in the DevContainer post-create script and pinned `@vscode/vsce` to version 3.7.1 in GitHub Actions workflows to prevent supply chain vulnerabilities from unpinned global package installations. - **fix**(_scripts_): Replaced `npm install` with `npm ci` in `.devcontainer/scripts/post-create.sh` for deterministic dependency installation using lockfile - **fix**(_build_): Pinned `@vscode/vsce` to version 3.7.1 in `.github/workflows/extension-package.yml` - **fix**(_build_): Pinned `@vscode/vsce` to version 3.7.1 in `.github/workflows/extension-publish.yml` ## Related Issue(s) Fixes #180 ## Type of Change Select all that apply: **Code & Documentation:** - [x] Bug fix (non-breaking change fixing an issue) - [ ] New feature (non-breaking change adding functionality) - [ ] Breaking change (fix or feature causing existing functionality to change) - [ ] Documentation update **Infrastructure & Configuration:** - [x] GitHub Actions workflow - [ ] Linting configuration (markdown, PowerShell, etc.) - [x] Security configuration - [x] DevContainer configuration - [ ] Dependency update **AI Artifacts:** - [ ] Reviewed contribution with `prompt-builder` chatmode and addressed all feedback - [ ] Copilot instructions (`.github/instructions/*.instructions.md`) - [ ] Copilot prompt (`.github/prompts/*.prompt.md`) - [ ] Copilot chatmode (`.github/chatmodes/*.chatmode.md`) > **Note for AI Artifact Contributors**: > > - **Chatmodes**: Research, indexing/referencing other project (using standard VS Code GitHub Copilot/MCP tools), planning, and general implementation chatmodes likely already exist. Review `.github/chatmodes/` before creating new ones. > - **Model Versions**: Only contributions targeting the **latest Anthropic and OpenAI models** will be accepted. Older model versions (e.g., GPT-3.5, Claude 3) will be rejected. > - See [Chatmodes Not Accepted](../docs/contributing/chatmodes.md#chatmodes-not-accepted) and [Model Version Requirements](../docs/contributing/ai-artifacts-common.md#model-version-requirements). **Other:** - [x] Script/automation (`.ps1`, `.sh`, `.py`) - [ ] Other (please describe): ## Sample Prompts (for AI Artifact Contributions) <!-- Not applicable - this PR does not include AI artifacts --> ## Testing - Verified file changes produce valid YAML syntax in GitHub Actions workflows - Confirmed shell script syntax is valid with `npm ci` command - Changes align with npm best practices for CI/CD environments ## Checklist ### Required Checks - [ ] Documentation is updated (if applicable) - [x] Files follow existing naming conventions - [x] Changes are backwards compatible (if applicable) ### AI Artifact Contributions <!-- Not applicable - this PR does not include AI artifacts --> ### Required Automated Checks The following validation commands must pass before merging: - [ ] Markdown linting: `npm run lint:md` - [ ] Spell checking: `npm run spell-check` - [ ] Frontmatter validation: `npm run lint:frontmatter` - [ ] Link validation: `npm run lint:md-links` - [ ] PowerShell analysis: `npm run lint:ps` ## Security Considerations - [x] This PR does not contain any sensitive or NDA information - [x] Any new dependencies have been reviewed for security issues - [x] Security-related scripts follow the principle of least privilege ## Additional Notes This change addresses OpenSSF Scorecard npm command pinning warnings: - `npm ci` uses the lockfile (`package-lock.json`) for deterministic, reproducible builds - Pinning `@vscode/[email protected]` prevents supply chain attacks from compromised latest versions - Both changes improve the repository's OpenSSF Scorecard security score 🔒 - Generated by Copilot
1 parent 64686e7 commit c29db54

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

.devcontainer/scripts/post-create.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -euo pipefail
77

88
main() {
99
echo "Installing NPM dependencies..."
10-
npm install
10+
npm ci
1111
echo "NPM dependencies installed successfully"
1212
}
1313

.github/workflows/extension-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
node-version: '20'
6060

6161
- name: Install dependencies
62-
run: npm install -g @vscode/vsce
62+
run: npm install -g @vscode/vsce@3.7.1
6363

6464
- name: Setup PowerShell
6565
shell: pwsh

.github/workflows/extension-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
node-version: '20'
127127

128128
- name: Install VSCE
129-
run: npm install -g @vscode/vsce
129+
run: npm install -g @vscode/vsce@3.7.1
130130

131131
- name: Download VSIX artifact
132132
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0

0 commit comments

Comments
 (0)