Skip to content

security(ci): pin SonarSource/sonarqube-scan-action to commit SHA (defense against mutable-tag supply-chain)#3379

Merged
deacon-mp merged 1 commit into
masterfrom
security/pin-sonarsource-action-sha
May 18, 2026
Merged

security(ci): pin SonarSource/sonarqube-scan-action to commit SHA (defense against mutable-tag supply-chain)#3379
deacon-mp merged 1 commit into
masterfrom
security/pin-sonarsource-action-sha

Conversation

@deacon-mp
Copy link
Copy Markdown
Contributor

Summary

`SonarSource/sonarqube-scan-action@v6.0.0` was referenced by mutable tag in two workflows that hold `SONAR_TOKEN` (and, for `quality.yml`, `GITHUB_TOKEN` too):

Tags are mutable. If SonarSource's org/account were ever compromised, an attacker could force-push `v6.0.0` to a malicious commit and exfiltrate `SONAR_TOKEN` on the next CI run, without a single line hitting our tree. This is exactly the supply-chain class GitHub recommends pinning by SHA to defend against.

Fix

Both call sites now reference the current `v6.0.0` commit by SHA:

```yaml
uses: SonarSource/sonarqube-scan-action@fd88b7d # v6.0.0
```

Matches the SHA-pinning style already used in this repo for `actions/checkout`, `actions/setup-python`, `actions/setup-node`, `actions/upload-artifact`, `actions/download-artifact`, and `github/codeql-action`. Dependabot's GitHub-Actions ecosystem will keep the SHA + tag-comment up to date going forward.

Test plan

  • CI: `Code Quality` workflow runs and the `SonarQube Scan` step succeeds (same scan behavior as before — only the action's resolution method changes).
  • On the next fork PR, `SonarQube Scan (Fork PR)` (sonar-fork-pr.yml) still triggers via `workflow_run` and produces a SonarCloud analysis.

Refs

We were referencing SonarSource/sonarqube-scan-action by mutable tag (@v6.0.0)
in both .github/workflows/quality.yml and the new .github/workflows/sonar-fork-pr.yml.
Mutable tags can be force-pushed; if SonarSource were ever compromised, an
attacker could rewrite v6.0.0 to point at a malicious commit and steal
SONAR_TOKEN (and, in quality.yml's case, GITHUB_TOKEN as well) on the next
CI run, with no commit hitting our tree.

Pin both call sites to the current v6.0.0 commit:

    SonarSource/sonarqube-scan-action@fd88b7d  # v6.0.0

Matches the SHA-pinning style used for actions/checkout, actions/setup-python,
actions/setup-node, actions/upload-artifact, actions/download-artifact, and
github/codeql-action elsewhere in this repo. Dependabot's GitHub-Actions
ecosystem will keep the SHA + tag-comment up to date going forward.

Reported externally on 2026-05-18 alongside the broader CI security pass.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Pins the third-party SonarQube scan GitHub Action to an immutable commit SHA in workflows that run with SONAR_TOKEN (and sometimes GITHUB_TOKEN), reducing exposure to mutable-tag supply-chain attacks.

Changes:

  • Updated .github/workflows/quality.yml to use a commit-SHA pin for SonarSource/sonarqube-scan-action (annotated with # v6.0.0).
  • Updated .github/workflows/sonar-fork-pr.yml to use the same commit-SHA pin for the SonarQube scan step.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/quality.yml Replaces SonarSource/sonarqube-scan-action@v6.0.0 with a commit SHA pin while keeping the same scan behavior/conditions.
.github/workflows/sonar-fork-pr.yml Replaces SonarSource/sonarqube-scan-action@v6.0.0 with a commit SHA pin in the trusted fork-PR scan workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link
Copy Markdown

@deacon-mp deacon-mp merged commit 0433803 into master May 18, 2026
13 checks passed
@deacon-mp deacon-mp deleted the security/pin-sonarsource-action-sha branch May 18, 2026 23:23
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