Skip to content

feat(security): add CodeQL, Semgrep, and Trivy scanning#356

Merged
rygel merged 2 commits intodevelopfrom
feat/security-scanners
Mar 20, 2026
Merged

feat(security): add CodeQL, Semgrep, and Trivy scanning#356
rygel merged 2 commits intodevelopfrom
feat/security-scanners

Conversation

@rygel
Copy link
Copy Markdown
Owner

@rygel rygel commented Mar 20, 2026

Summary

Adds three complementary security scanners, all reporting to GitHub Code Scanning (Security tab):

Scanner Type What it catches
CodeQL Semantic C# analysis Data-flow issues: injection, path traversal, auth bypass, insecure APIs
Semgrep Pattern-based SAST OWASP Top 10, common C# mistakes, hardcoded secrets (p/csharp, p/secrets, p/owasp-top-ten)
Trivy Filesystem scan Hardcoded secrets in source/config files, NuGet CVEs (second opinion alongside existing dotnet list package --vulnerable)

All three run on push/PR to main+develop (path-filtered) and weekly on schedule.

Notes

  • Semgrep: SEMGREP_APP_TOKEN is optional. Without it, OSS rule packs still run but findings won't appear in the Semgrep cloud dashboard.
  • CodeQL: Uses security-and-quality query suite — may surface existing findings on first run.
  • Trivy: Scans for CRITICAL, HIGH, and MEDIUM severity only to keep signal-to-noise high.

🤖 Generated with Claude Code

CodeQL (.github/workflows/codeql.yml):
  Semantic C# analysis with security-and-quality queries. Catches data-flow
  issues (injection, path traversal, auth bypass) that pattern-based tools
  miss. Runs on push/PR to main+develop and weekly on schedule.

Semgrep (.github/workflows/semgrep.yml):
  Pattern-based SAST using p/csharp, p/secrets, and p/owasp-top-ten rule
  packs. Complements CodeQL with fast, broad coverage of common C# mistakes
  and OWASP Top 10. SEMGREP_APP_TOKEN is optional — omit for OSS-only rules.

Trivy (.github/workflows/trivy.yml):
  Filesystem scan for hardcoded secrets and dependency vulnerabilities
  (CRITICAL/HIGH/MEDIUM). Catches secrets in source files and config that
  other scanners miss, and provides a second opinion on NuGet CVEs alongside
  the existing 'dotnet list package --vulnerable' check.

All three upload results as SARIF to GitHub Code Scanning so findings appear
in the Security tab alongside existing zizmor alerts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Build Performance Report

⏱️ Build Time: 12 minutes

📊 Comparison with main branch:

  • Baseline (avg): 10 minutes
  • Current: 12 minutes
  • Change: 📈 20%

✅ Within acceptable range


This is an automated performance check

@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

CodeQL  — weekly only (30-min build, deep semantic analysis)
Semgrep — PR gate + weekly (fast pattern-based SAST, new rule packs)
Trivy   — PR gate (secrets only) + weekly (secrets + vuln full scan)

Running all scanners on every push to main/develop was redundant:
protected branches require a PR, so the PR checks already cover each
push. Weekly schedules catch newly discovered CVEs and published rules
against the existing codebase without slowing down PR feedback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Build Performance Report

⏱️ Build Time: 12 minutes

📊 Comparison with main branch:

  • Baseline (avg): 10 minutes
  • Current: 12 minutes
  • Change: 📈 20%

✅ Within acceptable range


This is an automated performance check

@rygel rygel merged commit addc948 into develop Mar 20, 2026
10 checks passed
@rygel rygel deleted the feat/security-scanners branch March 20, 2026 04:45
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