Skip to content

PREQ-5138 authenticate NPM#230

Merged
claire-villard-sonarsource merged 1 commit intoclaire/upgrade-libsfrom
fix/jcarsique/PREQ-5138-npmAuth
Apr 13, 2026
Merged

PREQ-5138 authenticate NPM#230
claire-villard-sonarsource merged 1 commit intoclaire/upgrade-libsfrom
fix/jcarsique/PREQ-5138-npmAuth

Conversation

@julien-carsique-sonarsource
Copy link
Copy Markdown
Contributor

@julien-carsique-sonarsource julien-carsique-sonarsource commented Apr 10, 2026

@hashicorp-vault-sonar-prod
Copy link
Copy Markdown

hashicorp-vault-sonar-prod Bot commented Apr 10, 2026

PREQ-5138

@julien-carsique-sonarsource julien-carsique-sonarsource force-pushed the fix/jcarsique/PREQ-5138-npmAuth branch from 2456556 to 69186b2 Compare April 10, 2026 15:52
@sonarqubecloud
Copy link
Copy Markdown

@sonar-review-alpha
Copy link
Copy Markdown

sonar-review-alpha Bot commented Apr 10, 2026

Summary

This PR adds NPM authentication to the CI workflow to support access to private packages (likely via JFrog Repox). It makes three key changes:

  1. Switches the workflow runner to github-ubuntu-latest-s (a specific runner configuration)
  2. Adds OIDC (id-token: write) and content permissions to enable temporary credential generation
  3. Adds a new step that runs SonarSource/ci-github-actions/config-npm@v1 to configure NPM authentication

This enables the workflow to authenticate with the private NPM registry without embedding static credentials in the codebase. The actual authentication is delegated to the SonarSource reusable action, which likely exchanges the OIDC token for temporary Repox credentials.

What reviewers should know

Reviewer focus areas:

  • Runner change: The switch to github-ubuntu-latest-s is critical—verify this runner is available in your infrastructure and supports the authentication flow. If this runner doesn't exist or lacks OIDC support, the workflow will fail.

  • Permission scope: The id-token: write permission enables OIDC token generation. Confirm this aligns with your security policies for temporary credential generation. The contents: write permission may already be present in your workflows—verify it's actually needed here or if it's redundant.

  • External dependency: The config depends on SonarSource/ci-github-actions@v1. This action is external and reusable—check that it's well-maintained and understand what it does under the hood (does it modify .npmrc? Set env vars?). The linked terraform PR (#8923) likely contains the infrastructure setup required for this to work.

  • Testing: Ensure the workflow runs successfully with these changes. The new step will silently fail if the runner lacks OIDC support or if the Repox backend is misconfigured.


  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha Bot left a comment

Choose a reason for hiding this comment

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

Small, focused change. One permission concern worth addressing before merge.

🗣️ Give feedback

runs-on: github-ubuntu-latest-s
permissions:
id-token: write
contents: write
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overly permissive scope: contents: write grants the ability to push commits and modify repository contents. This workflow only checks out code, installs dependencies, and runs tests — none of that requires write access.

The default contents: read is sufficient here. If config-npm@v1 genuinely requires contents: write, that should be documented — but it would be unusual for an NPM authentication action to need it.

Drop this to read unless there is a concrete reason it must be write.

Suggested change
contents: write
id-token: write
contents: read
  • Mark as noise

@claire-villard-sonarsource claire-villard-sonarsource merged commit 335eaf6 into claire/upgrade-libs Apr 13, 2026
73 of 74 checks passed
@claire-villard-sonarsource claire-villard-sonarsource deleted the fix/jcarsique/PREQ-5138-npmAuth branch April 13, 2026 09:01
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