feat: code security scanner with OWASP pattern detection (#552) #716

Merged
jmiller merged 7 commits from feature/code-scanner into dev 2026-06-28 16:08:31 +00:00
Owner

Summary

  • New services/security/code_scanner.go implementing the Scanner interface
  • 22 pattern rules covering 7 CWE categories across Go, PHP, Python, JS/TS
  • Language-filtered by file extension for targeted scanning
  • Wired into orchestrator via existing CodeScanner config toggle
  • API updated: code_scanner field in GET/PATCH /security/config
  • Web UI toggle already existed in settings template

Rules by Category

Category CWE Rules Languages
SQL Injection CWE-89 4 Go, PHP, Python, JS/TS
XSS CWE-79 4 JS/TS, PHP, React
Command Injection CWE-78 5 Go, PHP, JS/TS, Python
Path Traversal CWE-22 3 Go, JS/TS, Python, PHP
Insecure Deserialization CWE-502 2 PHP, Python
Hardcoded Credentials CWE-798 1 All
Weak Cryptography CWE-327 2 Go, Python, C#, Java

Test plan

  • Enable code scanner via API: PATCH /security/config {"code_scanner": true}
  • Trigger scan: POST /security/scan
  • Verify alerts appear for repos with known patterns
  • Verify comment lines are skipped
  • Verify binary/vendor/node_modules files are skipped

https://claude.ai/code/session_011AAFzotGMf3ayvXhEmStCd

## Summary - New `services/security/code_scanner.go` implementing the Scanner interface - 22 pattern rules covering 7 CWE categories across Go, PHP, Python, JS/TS - Language-filtered by file extension for targeted scanning - Wired into orchestrator via existing `CodeScanner` config toggle - API updated: `code_scanner` field in GET/PATCH `/security/config` - Web UI toggle already existed in settings template ### Rules by Category | Category | CWE | Rules | Languages | |----------|-----|-------|-----------| | SQL Injection | CWE-89 | 4 | Go, PHP, Python, JS/TS | | XSS | CWE-79 | 4 | JS/TS, PHP, React | | Command Injection | CWE-78 | 5 | Go, PHP, JS/TS, Python | | Path Traversal | CWE-22 | 3 | Go, JS/TS, Python, PHP | | Insecure Deserialization | CWE-502 | 2 | PHP, Python | | Hardcoded Credentials | CWE-798 | 1 | All | | Weak Cryptography | CWE-327 | 2 | Go, Python, C#, Java | ## Test plan - [ ] Enable code scanner via API: `PATCH /security/config {"code_scanner": true}` - [ ] Trigger scan: `POST /security/scan` - [ ] Verify alerts appear for repos with known patterns - [ ] Verify comment lines are skipped - [ ] Verify binary/vendor/node_modules files are skipped https://claude.ai/code/session_011AAFzotGMf3ayvXhEmStCd
jmiller added 6 commits 2026-06-28 13:16:06 +00:00
fix: pr-check platform detection queries metadata API instead of removed manifest.xml
Universal: PR Check / Branch Policy (pull_request) Failing after 2s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Generic: Repo Health / Access control (pull_request) Successful in 2s
Universal: PR Check / Validate PR (pull_request) Successful in 14s
Generic: Project CI / Lint & Validate (pull_request) Successful in 40s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Failing after 1m24s
PR RC Release / Build RC Release (pull_request) Failing after 3m14s
Universal: PR Check / Secret Scan (pull_request) Successful in 3m15s
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
fa845164bb
The manifest.xml file no longer exists — platform is stored in the
MokoGitea metadata API. The old sed command failed with exit 2 under
bash -e, cascading failure to all subsequent validate steps.

Claude-Session: https://claude.ai/code/session_011AAFzotGMf3ayvXhEmStCd
fix: branch policy allows fix/patch branches to target main
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Universal: PR Check / Validate PR (pull_request) Successful in 18s
Generic: Project CI / Lint & Validate (pull_request) Successful in 1m4s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Failing after 1m32s
PR RC Release / Build RC Release (pull_request) Failing after 1m33s
Universal: PR Check / Secret Scan (pull_request) Successful in 1m32s
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
193c705c05
The pr-check branch policy only allowed fix/* -> dev, but the actual
org policy is fix/patch branches PR to main directly. Also updated
the summary text to list all allowed merge paths correctly.

Claude-Session: https://claude.ai/code/session_011AAFzotGMf3ayvXhEmStCd
docs: update README with new features from latest release
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Generic: Repo Health / Access control (pull_request) Successful in 2s
Universal: PR Check / Validate PR (pull_request) Successful in 13s
Generic: Project CI / Lint & Validate (pull_request) Successful in 35s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Failing after 1m24s
Universal: PR Check / Secret Scan (pull_request) Successful in 1m30s
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Successful in 2s
Universal: Workflow Sync Trigger / Sync workflows to live repos (pull_request) Successful in 6m10s
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
35ebbef489
Add cascade merge, secret scanning, default org teams, branch
protection delete allowlist to Key Features list.

Claude-Session: https://claude.ai/code/session_011AAFzotGMf3ayvXhEmStCd
feat: code security scanner with OWASP pattern detection (#552)
Universal: Auto Version Bump / Version Bump (push) Successful in 13s
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
PR RC Release / Build RC Release (pull_request) Successful in 2s
Universal: PR Check / Validate PR (pull_request) Successful in 12s
Generic: Project CI / Lint & Validate (pull_request) Successful in 37s
Universal: PR Check / Secret Scan (pull_request) Successful in 1m20s
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
7c75133ef1
Implements the code analysis scanner module that detects insecure
patterns across Go, PHP, Python, JavaScript, and TypeScript:

- SQL injection (CWE-89): string concat in queries across 4 languages
- XSS (CWE-79): innerHTML, document.write, unescaped output, dangerouslySetInnerHTML
- Command injection (CWE-78): exec with variables, shell=True, os.system
- Path traversal (CWE-22): unsanitized path joins, file open with user input
- Insecure deserialization (CWE-502): unserialize(), yaml.load()
- Hardcoded credentials (CWE-798): password assignments in source
- Weak cryptography (CWE-327): MD5/SHA-1 usage

22 rules total, language-filtered by file extension. Wired into the
existing scanner orchestrator via the CodeScanner config toggle.
API updated to expose code_scanner in GET/PATCH security config.

Claude-Session: https://claude.ai/code/session_011AAFzotGMf3ayvXhEmStCd
jmiller added 1 commit 2026-06-28 13:20:39 +00:00
docs: update README to reflect code security scanner
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
PR RC Release / Build RC Release (pull_request) Successful in 3s
Universal: PR Check / Validate PR (pull_request) Successful in 12s
Universal: Auto Version Bump / Version Bump (push) Successful in 18s
Generic: Project CI / Lint & Validate (pull_request) Successful in 39s
Universal: PR Check / Secret Scan (pull_request) Successful in 59s
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Successful in 2s
66aea89b40
Claude-Session: https://claude.ai/code/session_011AAFzotGMf3ayvXhEmStCd
jmiller merged commit 87f92fe1ab into dev 2026-06-28 16:08:31 +00:00
jmiller deleted branch feature/code-scanner 2026-06-28 16:08:31 +00:00
Sign in to join this conversation.