Commit graph

14 commits

Author SHA1 Message Date
sonarqube-agent[bot]
3624b79d9a
fix: Commit 1 - Fully fix javascript:S7780
Commit 1 of SonarQube suggestions

Fully fixed issues:
- [javascript:S7780] AZ3P6TLCKPJHm3wzH1C-: `String.raw` should be used to avoid escaping `\`.
- [javascript:S7780] AZ3P6TLCKPJHm3wzH1C_: `String.raw` should be used to avoid escaping `\`.
- [javascript:S7780] AZ3P6TLCKPJHm3wzH1DA: `String.raw` should be used to avoid escaping `\`.

Generated by SonarQube Agent
2026-04-27 17:13:05 +00:00
Claire Villard
daf2073c97 SQSCANGHA-140 Fix code smells
Apply linter fixes to address code smells:
- Use replaceAll() instead of replace() with regex for string replacement
- Update dist files with linter changes

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-27 19:10:48 +02:00
Claire Villard
7a11667fa2 SQSCANGHA-140 Fix GPG path handling for Windows
Fix GPG signature verification on Windows by converting Windows-style
paths to Unix-style paths that GPG expects. GPG on Windows (from Git
for Windows) is a Unix tool that requires Unix-style paths.

Issue: GPG was receiving Windows paths like C:\a\_temp\gpg-home and
attempting to use them, resulting in malformed paths like
/c/a/sonarqube-scan-action/C:\a\_temp\gpg-home and errors:
- "keyblock resource: No such file or directory"
- "can't connect to the dirmngr: No such file or directory"
- "keyserver receive failed: No dirmngr"

Solution:
- Add convertToUnixPath() function to convert Windows paths to Unix-style
  (e.g., C:\a\_temp\gpg -> /c/a/_temp/gpg)
- Apply conversion in tryImportKey() and runGpgVerify() before calling GPG
- No-op on non-Windows platforms
- Add comprehensive tests for path conversion

This ensures GPG signature verification works on all platforms (Linux,
macOS, and Windows).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-27 19:06:35 +02:00
Claire Villard
79d962c4f8 SQSCANGHA-140 Add fallback keyserver for GPG signature verification
Add hkps://keys.openpgp.org as fallback keyserver to improve reliability
when the primary keyserver (keyserver.ubuntu.com) is unavailable due to
outages, network issues, or rate limiting.

Changes:
- Extract key import logic into tryImportKey() helper function
- Implement automatic fallback in importSonarSourceKey()
- Add comprehensive error messages showing both keyserver failures
- Add integration tests verifying fallback mechanism
- Update JSDoc to document fallback behavior
- Rebuild distribution

The implementation maintains backward compatibility with no changes to
function signatures or default behavior. Primary keyserver is always
attempted first.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-27 18:39:12 +02:00
Claire Villard
e8b2382915 SQSCANGHA-140 Implement OpenPGP signature verification for scanner downloads
Add GPG signature verification to ensure downloaded Sonar Scanner CLI binaries
are authentic and haven't been tampered with. This implements supply chain
security by verifying signatures against SonarSource's public key.

Changes:
- Add gpg-verification.js module with signature verification logic
- Download and verify .asc signature files alongside scanner ZIPs
- Import SonarSource public key from keyserver.ubuntu.com
- Add skipSignatureVerification input parameter (default: false)
- Add @actions/exec dependency for cross-platform GPG execution
- Add comprehensive unit tests for verification functions
- Update dist with bundled changes

Verification is enabled by default and uses an isolated temporary GPG home
directory to avoid polluting user's keyring. All temporary files are cleaned
up properly, even on errors.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-27 17:54:16 +02:00
Claire Villard
f00de44f57
SC-45750 Migrate to dateless license headers (#229)
Some checks failed
QA Main action / 'projectBaseDir' input (push) Has been cancelled
QA Main action / 'projectBaseDir' input -1 (push) Has been cancelled
QA Main action / 'projectBaseDir' input -2 (push) Has been cancelled
QA Main action / 'scannerVersion' input (push) Has been cancelled
QA Main action / 'scannerBinariesUrl' input with invalid URL (push) Has been cancelled
QA Main action / 'scannerBinariesUrl' is escaped with wget so special chars are not injected in the download command (push) Has been cancelled
QA Main action / 'scannerBinariesUrl' is escaped with curl so special chars are not injected in the download command (push) Has been cancelled
QA Main action / Don't fail on Gradle project (push) Has been cancelled
QA Main action / Don't fail on Kotlin Gradle project (push) Has been cancelled
QA Main action / Don't fail on Maven project (push) Has been cancelled
QA Main action / runAnalysisTest (push) Has been cancelled
QA Main action / 'RUNNER_DEBUG' is used (push) Has been cancelled
QA Main action / 'RUNNER_DEBUG' is used -1 (push) Has been cancelled
QA Main action / 'RUNNER_DEBUG' is used -2 (push) Has been cancelled
QA Main action / runAnalysisWithCacheTest (push) Has been cancelled
QA Main action / 'SONARCLOUD_URL' is used (push) Has been cancelled
QA Main action / 'SONARCLOUD_URL' is used -1 (push) Has been cancelled
QA Main action / 'SONARCLOUD_URL' is used -2 (push) Has been cancelled
QA Main action / curl performs redirect when scannerBinariesUrl returns 3xx (push) Has been cancelled
QA Main action / 'SONAR_ROOT_CERT' is converted to truststore (push) Has been cancelled
QA Main action / 'SONAR_ROOT_CERT' is converted to truststore -1 (push) Has been cancelled
QA Main action / 'SONAR_ROOT_CERT' is converted to truststore -2 (push) Has been cancelled
QA Main action / Analysis takes into account 'SONAR_ROOT_CERT' (push) Has been cancelled
QA Main action / truststore.p12 is updated when present (push) Has been cancelled
QA Main action / 'scannerVersion' input validation (push) Has been cancelled
QA Scripts / create_install_path.sh (push) Has been cancelled
QA Scripts / configure_paths.sh (push) Has been cancelled
QA Scripts / download.sh (push) Has been cancelled
QA Scripts / fetch_latest_version.sh (push) Has been cancelled
Unit tests / test (push) Has been cancelled
2026-04-10 13:57:27 +02:00
Jeremy Davis
ff001fd600 SQSCANGHA-107 Migrate install-build-wrapper 2025-09-18 10:38:53 +02:00
Jeremy Davis
a88c96d7e4 SQSCANGHA-107 Make room for install-build-wrapper action 2025-09-18 10:38:53 +02:00
Jeremy Davis
a64281002c SQSCANGHA-112 SQSCANGHA-113 Fixes from review and keytool refactor 2025-09-18 10:38:53 +02:00
Jeremy Davis
ece10df5d7 SQSCANGHA-112 Extract installation step and other fixes 2025-09-18 10:38:53 +02:00
Jeremy Davis
16df975da5 SQSCANGHA-113 Migrate scanner run step 2025-09-18 10:38:53 +02:00
Jeremy Davis
ed9f3aad50 SQSCANGHA-112 Migrate installation step 2025-09-18 10:38:53 +02:00
Jeremy Davis
6a808e9a20 SQSCANGHA-115 Migrate sanity checks 2025-09-18 10:38:53 +02:00
Jeremy Davis
9db61695c9 SQSCANGHA-117 Set up js build 2025-09-18 10:38:53 +02:00