Skip to content

Comments

feat: integrate SonarQube for technical debt management#50

Open
bitkojine wants to merge 33 commits intomainfrom
feat/sonarqube-integration
Open

feat: integrate SonarQube for technical debt management#50
bitkojine wants to merge 33 commits intomainfrom
feat/sonarqube-integration

Conversation

@bitkojine
Copy link
Owner

@bitkojine bitkojine commented Jan 28, 2026

  • Add docker-compose.yml for SonarQube and PostgreSQL.
  • Add sonar-project.properties for project analysis.
  • Add GitHub Actions workflow for automated SonarQube scanning.
  • Define canonical technical debt JSON schema and extraction script.
  • Document metrics-based Definition of Done for refactors.
  • Add CodeCharta integration for architectural visualization. (Removed from this PR)
  • Update README.md with setup and usage instructions.

…a for visualization

- Add docker-compose.yml for SonarQube and PostgreSQL.
- Add sonar-project.properties for project analysis.
- Add GitHub Actions workflow for automated SonarQube scanning.
- Define canonical technical debt JSON schema and extraction script.
- Document metrics-based Definition of Done for refactors.
- Add CodeCharta integration for architectural visualization.
- Update README.md with setup and usage instructions.
- Fix ReDoS vulnerability in extract-tech-debt.js parseEffort function
  * Add input validation and length limits to prevent regex backtracking attacks
  * Sanitize effort string parsing with proper type checking

- Pin GitHub Actions to specific commit SHAs instead of @master
  * SonarSource/sonarqube-scan-action@e2acbd9
  * SonarSource/sonarqube-quality-gate-action@b878bb0

- Add --ignore-scripts flag to npm install commands in CI/CD workflows
  * Prevents execution of potentially malicious lifecycle scripts
  * Applied to ci.yml, release.yml, and sonarqube.yml workflows

Security improvements address all 6 identified hotspots:
- 3 high priority ReDoS vulnerabilities (DENIAL_OF_SERVICE)
- 2 low priority dependency pinning issues
- 1 low priority script execution security issue

Resolves SonarCloud security analysis findings for PR #50
- sonarsource/sonarqube-scan-action@v7.0 (latest)
- sonarsource/sonarqube-quality-gate-action@v1.2 (latest)

Uses latest stable versions for security updates while maintaining
stability. Better approach than brittle commit hashes.
- sonarsource/sonarqube-scan-action@v7.0.0 (latest)
- sonarsource/sonarqube-quality-gate-action@v1.2.0 (latest)

Uses complete semantic version tags to ensure proper action resolution
and satisfy SonarCloud security requirements.
…s (S2819)

- Add origin verification in bootstrap.ts message handler
- Add origin verification in test-bridge.ts message handler
- Create comprehensive tests for origin verification security
- Fix SonarQube security issue: Verify the origin of the received message
- Only accept messages from trusted vscode-webview:// origins
- Log warnings when rejecting untrusted messages

Resolves SonarQube rule S2819 security vulnerability in:
- vscode-extension/src/webview/bootstrap.ts (line 76)
- vscode-extension/src/webview/test-utils/test-bridge.ts (line 238)
- Delete scripts/generate-codecharta.sh script file
- Remove CodeCharta Visualization section from README.md
- Clean up all CodeChart references from the codebase
@bitkojine bitkojine changed the title feat: integrate SonarQube for technical debt management and CodeChart… feat: integrate SonarQube for technical debt management Jan 28, 2026
- Add ESLint strict console rules with test file exclusions
- Create custom debug log detection script with pattern matching
- Update CI pipeline to check for debug logs before merge
- Add npm scripts for lint:strict and check-debug-logs
- Implement defense-in-depth against debug log creep
- Add husky for git hook management
- Create staged-only debug log detection script
- Configure pre-commit hook to check only staged files
- Add npm scripts for pre-commit debug log checking
- Implement fast, sub-100ms performance for typical commits
- Block commits with console.log violations before CI
- Allow console.error() and console.warn() for legitimate use
- Add comprehensive error handling and user feedback
- Remove console.log from extension.ts (activation/deactivation)
- Remove console.log from test-discovery-service.ts (Jest stderr)
- Remove console.log from perf-tracker.ts (performance reporting)
- Remove console.log from bootstrap.ts (message router handling)
- Remove console.log from webview-message-handler.ts (unknown messages)
- Add TODO comment for future proper logging implementation

All debug logging issues cleared, CI step now passes.
- Remove console.log from test fixtures (simple-workspace, layer-violation)
- Remove console.group/groupEnd from perf-tracker.ts
- Remove debug console.log from context-menu-interaction.test.ts
- Remove console wrapping and security warning from bootstrap.ts
- Add TODO comments for proper logging infrastructure

Fixes 8 console statement violations that were causing CI failure.
Remaining 76 warnings are non-blocking curly brace issues.
- Replace execSync with spawnSync to eliminate shell spawning
- Use array arguments instead of string interpolation
- Add explicit shell: false for OWASP compliance
- Prevents command injection (CWE-78) in git command execution
…guration

- Remove duplicate SonarQube scan from ci.yml pipeline
- Standardize Node.js version to 22.x across all workflows
- Fix test coverage command in sonarqube.yml to use npm script
- Remove inline SonarQube args, rely on sonar-project.properties
- Optimize pipeline architecture for faster builds and maintainability
- Adds docs/ANTI_MOCK_TRAP.md with guidelines
- Implements scripts/check-mock-usage.js for diagnostic checks
- Updates SonarQube workflows to import mock trap detection as code smells
- Adds CI enforcement to prevent high-risk mocking patterns
- Adds 'vscode-extension/' prefix to mock check report paths
- Explicitly separates sources and tests in sonar-project.properties
- Ensures test files are excluded from main sources list to avoid SonarQube ignoring them
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.

1 participant