Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SQSCANGHA-146 Add proxy support for GPG keyserver access#244

Merged
henryju merged 3 commits into
masterfrom
jh/SQSCANGHA-146_gpg_proxy
May 19, 2026
Merged

SQSCANGHA-146 Add proxy support for GPG keyserver access#244
henryju merged 3 commits into
masterfrom
jh/SQSCANGHA-146_gpg_proxy

Conversation

@henryju
Copy link
Copy Markdown
Member

@henryju henryju commented May 18, 2026

Internal PR to verify #242

@sonar-review-alpha
Copy link
Copy Markdown

sonar-review-alpha Bot commented May 18, 2026

Summary

This PR adds automatic proxy support for GPG keyserver access during SonarScanner CLI signature verification. The action now respects HTTPS_PROXY and https_proxy environment variables when fetching public keys from the keyserver over HTTPS.

Key implementation details:

  • Added getProxyFromEnv() function that checks for HTTPS_PROXY or https_proxy (intentionally skips HTTP_PROXY variants since keyservers use TLS/hkps)
  • Modified tryImportKey() to pass the proxy to gpg --recv-keys via --keyserver-options http-proxy=...
  • Proxy credentials are masked via core.setSecret() to prevent leaks in CI logs
  • Updated README to document the proxy behavior
  • Test helper functions (clearProxyEnv, proxyVars) hoisted to prevent duplication across test suites

What reviewers should know

Start with:

  • src/main/gpg-verification.js — Core implementation of getProxyFromEnv() and proxy integration in tryImportKey()
  • src/main/__tests__/gpg-verification-mocked.test.js — Comprehensive test coverage for proxy scenarios (6 test cases for getProxyFromEnv behavior + 5 for tryImportKey with proxy)

Key decisions to review:

  • HTTP proxy intentionally excluded: keyservers are HTTPS-only (hkps://), so routing over an HTTP proxy designed for HTTP traffic would be incorrect
  • Proxy URL is registered as a secret immediately to catch any future logging that might expose credentials
  • The info message intentionally drops the proxy URL to avoid exposing credentials in logs even after masking

Watch for:

  • The proxy URL format: must be a valid HTTP URL like http://host:port or http://user:pass@host:port
  • Test isolation: each test clears proxy env vars via clearProxyEnv() to prevent test pollution
  • Dist files: large regeneration due to bundler changes; verify stale chunks are properly cleaned up

  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

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

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

SQSCANGHA-146

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.

Clean, focused implementation. The proxy detection logic, GPG argument construction, and documentation all look correct. One genuine question before approving: the proxy URL is logged to CI output via core.info, which is fine for plain proxy URLs, but some organizations encode credentials directly in proxy URLs (e.g. http://user:password@proxy:8080). Since this action targets corporate proxy environments specifically, it's worth confirming the team is comfortable with that being printed in job logs — or masking it with core.setSecret if credentials in proxy URLs are a realistic concern.

🗣️ Give feedback

Comment thread src/main/gpg-verification.js
Comment thread src/main/__tests__/gpg-verification-mocked.test.js Outdated
Normalize CRLF to LF in the rollup load hook so Windows checkouts
produce the same dist bundle and source maps as Linux/macOS.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
sonar-review-alpha[bot]

This comment was marked as outdated.

- Register HTTPS_PROXY as a secret via core.setSecret so embedded
  credentials (e.g. http://user:pass@proxy:8080) cannot leak to CI
  logs, and drop the URL from the info message.
- Hoist clearProxyEnv()/proxyVars to the outer describe scope in the
  GPG verification tests (Sonar S4144).

dist/ regenerated; this also drops stale chunk files that were no
longer emitted by the current rollup config.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@sonarqubecloud
Copy link
Copy Markdown

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.

Both previously flagged issues are now resolved: the credential-in-log issue is fixed by calling core.setSecret(proxyUrl) before any logging, and the test-isolation concern is moot as the tests are unchanged in this diff.

🗣️ Give feedback

Copy link
Copy Markdown
Contributor

@antoine-vinot-sonarsource antoine-vinot-sonarsource left a comment

Choose a reason for hiding this comment

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

LGTM!

@henryju henryju merged commit 5656853 into master May 19, 2026
75 checks passed
@henryju henryju deleted the jh/SQSCANGHA-146_gpg_proxy branch May 19, 2026 07:11
luketainton pushed a commit to luketainton/repos_epage-go that referenced this pull request May 19, 2026
…(#11)

This PR contains the following updates:

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

---

### Release Notes

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

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

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

#### What's Changed

- SQSCANGHA-146 Add proxy support for GPG keyserver access by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;244](SonarSource/sonarqube-scan-action#244)
- SQSCANGHA-148 Update SonarScanner CLI to 8.1.0.6389 by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in [#&#8203;232](SonarSource/sonarqube-scan-action#232)

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

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

[Compare Source](SonarSource/sonarqube-scan-action@v8...v8.1.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:eyJjcmVhdGVkSW5WZXIiOiI0My4xODUuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE4NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/epage-go/pulls/11
Co-authored-by: renovate[bot] <[email protected]>
Co-committed-by: renovate[bot] <[email protected]>
luketainton pushed a commit to luketainton/repos_pypilot that referenced this pull request May 19, 2026
…(#449)

This PR contains the following updates:

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

---

### Release Notes

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

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

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

#### What's Changed

- SQSCANGHA-146 Add proxy support for GPG keyserver access by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;244](SonarSource/sonarqube-scan-action#244)
- SQSCANGHA-148 Update SonarScanner CLI to 8.1.0.6389 by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in [#&#8203;232](SonarSource/sonarqube-scan-action#232)

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

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

[Compare Source](SonarSource/sonarqube-scan-action@v8...v8.1.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:eyJjcmVhdGVkSW5WZXIiOiI0My4xODUuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE4NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.tainton.uk/repos/pypilot/pulls/449
Co-authored-by: renovate[bot] <[email protected]>
Co-committed-by: renovate[bot] <[email protected]>
luketainton pushed a commit to luketainton/repos_roboluke that referenced this pull request May 19, 2026
…(#452)

This PR contains the following updates:

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

---

### Release Notes

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

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

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

#### What's Changed

- SQSCANGHA-146 Add proxy support for GPG keyserver access by [@&#8203;henryju](https://github.com/henryju) in [#&#8203;244](SonarSource/sonarqube-scan-action#244)
- SQSCANGHA-148 Update SonarScanner CLI to 8.1.0.6389 by [@&#8203;github-actions](https://github.com/github-actions)\[bot] in [#&#8203;232](SonarSource/sonarqube-scan-action#232)

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

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

[Compare Source](SonarSource/sonarqube-scan-action@v8...v8.1.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:eyJjcmVhdGVkSW5WZXIiOiI0My4xODUuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE4NS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

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

3 participants