fix: Fail closed when C# security scanning fails#1792
Conversation
Validate the pinned CodeQL report before upload so missing, malformed, or degraded C# analysis cannot be reported as a successful zero-finding scan.
Replace the placeholder SecurityCodeScan workflow with a pinned no-build CodeQL analysis and validate its SARIF before uploading any results.
Make schema and bundled CodeQL version changes explicit failures before a security scan result can be uploaded.
|
Warning Review limit reached
Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe security scan workflow now uses CodeQL for C# analysis, validates generated SARIF reports with a new Go guard, and uploads verified results. Tests cover SARIF quality and failure cases, while workflow trigger coverage and shell-based workflow assertions are expanded. ChangesCodeQL SARIF security scanning
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant GitHubActions
participant CodeQL
participant SARIFGuard
participant GitHubCodeScanning
GitHubActions->>CodeQL: Analyze C# code
CodeQL-->>GitHubActions: Generate SARIF
GitHubActions->>SARIFGuard: Validate SARIF
SARIFGuard-->>GitHubActions: Return validation result
GitHubActions->>GitHubCodeScanning: Upload verified SARIF
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
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:
For more information about GitHub Code Scanning, check out the documentation. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
cli/release-automation/internal/automation/codeql_sarif_guard_test.go (1)
212-214: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
intJSONhelper only supports 0-99.Fine for current test values, but silently breaks for 100 (a natural boundary for a percentage) since
rune('0'+10)is not a digit.♻️ Suggested fix
-func intJSON(value int) string { - return string(rune('0'+value/10)) + string(rune('0'+value%10)) -} +func intJSON(value int) string { + return strconv.Itoa(value) +}(requires importing
strconv)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cli/release-automation/internal/automation/codeql_sarif_guard_test.go` around lines 212 - 214, Update the intJSON helper to serialize arbitrary integer values correctly, including 100 and larger, by using strconv rather than manually constructing two digits. Add the required import and preserve the helper’s string return contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/security-scan.yml:
- Around line 62-65: Update the CodeQL paths configuration in the security scan
workflow to include all repository directories containing C# sources, including
Assets/Editor, Assets/Scenes, tools/, and tests/, while retaining the existing
Packages/src and Assets/Tests coverage.
---
Nitpick comments:
In `@cli/release-automation/internal/automation/codeql_sarif_guard_test.go`:
- Around line 212-214: Update the intJSON helper to serialize arbitrary integer
values correctly, including 100 and larger, by using strconv rather than
manually constructing two digits. Add the required import and preserve the
helper’s string return contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: df5e8dc3-9c38-4b5d-a32d-d22c10768268
📒 Files selected for processing (7)
.github/workflows/build-and-test.yml.github/workflows/security-scan.ymlcli/release-automation/cmd/check-codeql-sarif/main.gocli/release-automation/internal/automation/codeql_sarif_guard.gocli/release-automation/internal/automation/codeql_sarif_guard_test.gocli/release-automation/internal/automation/testdata/codeql-cli-2.26.0-sarif.jsonscripts/test-security-scan-workflow.sh
Keep extractor-collapse thresholds fail closed while surfacing movement below the approved proof baseline as a nonblocking GitHub Actions warning. Record the real security-extended probe and scanner selection evidence so the workflow cannot rely on synthetic zero-result SARIF alone.
Use decimal conversion for all quality percentages so future 100% fixtures remain valid, and record why expanding beyond the approved package corpus requires a separate baseline review.
|
@coderabbitai review Review follow-up is in commit |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
cd /repo 2>/dev/null || true
git fetch origin pull/1792/head:pr1792 2>&1 | tail -5
git log --oneline -5 pr1792 2>&1
git show 54f4f8f9 --stat 2>&1 | head -50
git show 54f4f8f9 -- cli/release-automation/internal/automation/codeql_sarif_guard_test.go 2>&1 | head -200Length of output: 2619
This resolves the earlier concern about the fixture helper breaking on 100% values. Kicking off a fresh review of the PR now. ✅ Action performedReview finished.
|
bc8be01
into
security/cli-distribution-hardening-integration
Summary
build-mode: noneandsecurity-extended.Security behavior
security-events: write.not-configured, so the advanced workflow upload does not conflict with default setup.Probe evidence
An out-of-repository temporary .NET Framework probe passed
HttpContextquery input toProcess.Start. CodeQL CLI 2.26.0 withcodeql/csharp-queries@1.7.5andsecurity-extendedproduced onecs/command-line-injectionresult in SARIF 2.1.0. The vulnerable source and analysis database were removed; a minimal result fixture remains solely as regression evidence.Scanner decision
The full decision and future accuracy work are recorded in
docs/security-scan-engine-decision.md.Verification
scripts/test-security-scan-workflow.shgo test ./cmd/check-codeql-sarif ./internal/automationactionlint v1.7.12 .github/workflows/security-scan.ymlscripts/check-go-cli.sh54f4f8f98aec26d1300a0cb661b41e9988ddfc7dgovulncheck