Skip to content

SQSCANGHA-149 Add scannerBinariesAuthHeader input#246

Merged
henryju merged 1 commit into
masterfrom
jh/SQSCANGHA-149_custom_binaries_auth
Jun 4, 2026
Merged

SQSCANGHA-149 Add scannerBinariesAuthHeader input#246
henryju merged 1 commit into
masterfrom
jh/SQSCANGHA-149_custom_binaries_auth

Conversation

@henryju

@henryju henryju commented May 29, 2026

Copy link
Copy Markdown
Member

Organisations using private Artifactory mirrors require authentication to download the SonarScanner CLI. This adds an optional scannerBinariesAuthHeader input whose value is forwarded as the Authorization HTTP header to both the binary and GPG signature downloads via tc.downloadTool's built-in auth parameter. No new dependencies are introduced.

Please be aware that we are not actively looking for feature contributions. The truth is that it's extremely difficult for someone outside SonarSource to comply with our roadmap and expectations. Therefore, we typically only accept minor cosmetic changes and typo fixes. If you would like to see a new feature, please create a new thread in the forum "Suggest new features".

With that in mind, if you would like to submit a code contribution, make sure that you adhere to the following guidelines and all tests are passing:

  • Please explain your motives to contribute this change: what problem you are trying to fix, what improvement you are trying to make
  • Make sure any code you changed is covered by tests
  • If there is a JIRA ticket available, please make your commits and pull request start with the ticket ID (SONAR-XXXX)

We will try to give you feedback on your contribution as quickly as possible.

Thank You!
The SonarSource Team

@sonarqubecloud

sonarqubecloud Bot commented May 29, 2026

Copy link
Copy Markdown

Agentic Analysis: Early Results

Agentic Analysis and Context Augmentation are available on your project. Here are some issues that could have been prevented. Follow the links to learn how to put them into action.

7 issue(s) found across 1 file(s):

Rule File Line Message
javascript:S5443 src/main/__tests__/install-sonar-scanner.test.js 52 Make sure publicly writable directories are used safely here.
javascript:S5443 src/main/__tests__/install-sonar-scanner.test.js 53 Make sure publicly writable directories are used safely here.
javascript:S5443 src/main/__tests__/install-sonar-scanner.test.js 100 Make sure publicly writable directories are used safely here.
javascript:S5443 src/main/__tests__/install-sonar-scanner.test.js 101 Make sure publicly writable directories are used safely here.
javascript:S5443 src/main/__tests__/install-sonar-scanner.test.js 146 Make sure publicly writable directories are used safely here.
javascript:S5443 src/main/__tests__/install-sonar-scanner.test.js 147 Make sure publicly writable directories are used safely here.
javascript:S5443 src/main/__tests__/install-sonar-scanner.test.js 181 Make sure publicly writable directories are used safely here.

Analyzed by SonarQube Agentic Analysis in 4.1 s

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented May 29, 2026

Copy link
Copy Markdown

SQSCANGHA-149

Comment thread src/main/index.js
@henryju henryju force-pushed the jh/SQSCANGHA-149_custom_binaries_auth branch from f55d92a to ecbf196 Compare June 1, 2026 08:18
@henryju

henryju commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

FV:

      - name: Run SonarQube analysis
        uses: SonarSource/sonarqube-scan-action@jh/SQSCANGHA-149_custom_binaries_auth
        env:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        with:
          args: >
            -Dsonar.organization=henryju
            -Dsonar.projectKey=henryju_sonar_scanner_npm
          scannerBinariesUrl: https://jhenry.ngrok.app
image
      - name: Run SonarQube analysis
        uses: SonarSource/sonarqube-scan-action@jh/SQSCANGHA-149_custom_binaries_auth
        env:
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        with:
          args: >
            -Dsonar.organization=henryju
            -Dsonar.projectKey=henryju_sonar_scanner_npm
          scannerBinariesUrl: https://jhenry.ngrok.app
          scannerBinariesAuthHeader: "Basic dXNlcjpwYXNz" # Don't do that in prod, use a secret variable
image

@henryju henryju force-pushed the jh/SQSCANGHA-149_custom_binaries_auth branch from ecbf196 to 8469add Compare June 2, 2026 17:18
Comment thread src/main/index.js
…inary downloads

Organisations using private Artifactory mirrors require authentication to
download the SonarScanner CLI. This adds an optional scannerBinariesAuthHeader
input whose value is forwarded as the Authorization HTTP header to both the
binary and GPG signature downloads via tc.downloadTool's built-in auth
parameter. No new dependencies are introduced.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@henryju henryju force-pushed the jh/SQSCANGHA-149_custom_binaries_auth branch from 8469add to 2ff2ba6 Compare June 4, 2026 08:04
@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2026

Copy link
Copy Markdown

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code and FV looking good to me!

@henryju henryju merged commit 375c3f5 into master Jun 4, 2026
75 checks passed
@henryju henryju deleted the jh/SQSCANGHA-149_custom_binaries_auth branch June 4, 2026 12:19
@gitar-bot

gitar-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 resolved / 2 findings

Adds the scannerBinariesAuthHeader input to enable authenticated downloads of scanner binaries. The auth header is now masked using core.setSecret() to resolve potential security exposure.

✅ 2 resolved
Security: Auth header not masked with core.setSecret()

📄 src/main/index.js:36
The scannerBinariesAuthHeader input contains a sensitive credential (e.g. Bearer <token>) but is never registered with core.setSecret(). If any downstream code (including @actions/tool-cache internals in debug mode, or future logging) prints this value, it will appear in plain text in workflow logs.

GitHub Actions only auto-masks values retrieved via core.getInput() if they were defined as secrets at the workflow level, but the action itself should defensively mask the value to prevent accidental exposure regardless of how the user passes it.

Security: Auth header may leak to default public binaries server

📄 src/main/index.js:36-39
When scannerBinariesAuthHeader is provided but scannerBinariesUrl is left at its default (https://binaries.sonarsource.com/...), the authorization header will be sent to the public SonarSource server. This is likely a misconfiguration, but the action could guard against it by warning or skipping the auth header when the URL is the default.

Consider adding a warning in getInputs() or in installSonarScanner() when scannerBinariesAuthHeader is set but scannerBinariesUrl is still the default value.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

luketainton pushed a commit to luketainton/repos_epage-go that referenced this pull request Jun 9, 2026
…(#12)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [SonarSource/sonarqube-scan-action](https://github.com/SonarSource/sonarqube-scan-action) | action | minor | `v8.1` → `v8.2` |

---

### Release Notes

<details>
<summary>SonarSource/sonarqube-scan-action (SonarSource/sonarqube-scan-action)</summary>

### [`v8.2.0`](https://github.com/SonarSource/sonarqube-scan-action/releases/tag/v8.2.0)

[Compare Source](SonarSource/sonarqube-scan-action@v8.2.0...v8.2.0)

#### What's Changed

- SQSCANGHA-149 Add scannerBinariesAuthHeader input by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;246](SonarSource/sonarqube-scan-action#246)
- SQSCANGHA-88 Deprecate the SONARCLOUD\_URL env variable support by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;249](SonarSource/sonarqube-scan-action#249)
- SQSCANGHA-84 Remove outdated wget/curl references by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;248](SonarSource/sonarqube-scan-action#248)
- SQSCANGHA-135 Fix scanner binaries always re-downloaded due to incompatible 4-part version by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;250](SonarSource/sonarqube-scan-action#250)
- SQSCANGHA-127 Rename downloaded file to .zip before extraction on Windows by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;251](SonarSource/sonarqube-scan-action#251)

**Full Changelog**: <SonarSource/sonarqube-scan-action@v8...v8.2.0>

### [`v8.2`](SonarSource/sonarqube-scan-action@v8.1.0...v8.2.0)

[Compare Source](SonarSource/sonarqube-scan-action@v8.1.0...v8.2.0)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMTYuMiIsInVwZGF0ZWRJblZlciI6IjQzLjIxNi4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/epage-go/pulls/12
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
luketainton pushed a commit to luketainton/repos_roboluke that referenced this pull request Jun 9, 2026
…(#455)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [SonarSource/sonarqube-scan-action](https://github.com/SonarSource/sonarqube-scan-action) | action | minor | `v8.1` → `v8.2` |

---

### Release Notes

<details>
<summary>SonarSource/sonarqube-scan-action (SonarSource/sonarqube-scan-action)</summary>

### [`v8.2.0`](https://github.com/SonarSource/sonarqube-scan-action/releases/tag/v8.2.0)

[Compare Source](SonarSource/sonarqube-scan-action@v8.2.0...v8.2.0)

#### What's Changed

- SQSCANGHA-149 Add scannerBinariesAuthHeader input by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;246](SonarSource/sonarqube-scan-action#246)
- SQSCANGHA-88 Deprecate the SONARCLOUD\_URL env variable support by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;249](SonarSource/sonarqube-scan-action#249)
- SQSCANGHA-84 Remove outdated wget/curl references by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;248](SonarSource/sonarqube-scan-action#248)
- SQSCANGHA-135 Fix scanner binaries always re-downloaded due to incompatible 4-part version by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;250](SonarSource/sonarqube-scan-action#250)
- SQSCANGHA-127 Rename downloaded file to .zip before extraction on Windows by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;251](SonarSource/sonarqube-scan-action#251)

**Full Changelog**: <SonarSource/sonarqube-scan-action@v8...v8.2.0>

### [`v8.2`](SonarSource/sonarqube-scan-action@v8.1.0...v8.2.0)

[Compare Source](SonarSource/sonarqube-scan-action@v8.1.0...v8.2.0)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMTYuMiIsInVwZGF0ZWRJblZlciI6IjQzLjIxNi4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/roboluke/pulls/455
Co-authored-by: renovate[bot] <renovate-bot@git.tainton.uk>
Co-committed-by: renovate[bot] <renovate-bot@git.tainton.uk>
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