Conversation
There was a problem hiding this comment.
Review Summary
This PR enhances IaC CI security scanning capabilities and hardens the Kubernetes workload configuration. The approach is solid, but there are 2 critical issues that must be addressed before merge:
Critical Issues
- Pod crash risk: The nginx image runs as root by default, conflicting with
runAsNonRoot: truesecurityContext - CI reliability: Missing error handling for SARIF upload could mask Checkov findings
Positive Changes
- Added comprehensive security scanning with Checkov SARIF output and Trivy IaC scanning
- Proper GitHub security-events permissions for code scanning integration
- Added pod-level security hardening with seccomp profile
Please address the blocking issues identified in the inline comments.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
| securityContext: | ||
| runAsNonRoot: true | ||
| seccompProfile: | ||
| type: RuntimeDefault |
There was a problem hiding this comment.
🛑 Crash Risk: Pod will fail to start because nginx:1.27.0 runs as root by default, but pod securityContext enforces runAsNonRoot: true. Change to nginx:1.27.0-alpine-slim or add runAsUser/runAsGroup with a non-root UID (e.g., 101) to the pod securityContext, or use an nginx image variant that runs as non-root by default.
| securityContext: | |
| runAsNonRoot: true | |
| seccompProfile: | |
| type: RuntimeDefault | |
| securityContext: | |
| runAsNonRoot: true | |
| runAsUser: 101 | |
| runAsGroup: 101 | |
| seccompProfile: | |
| type: RuntimeDefault |
| - name: Upload Checkov SARIF report | ||
| if: always() | ||
| uses: github/codeql-action/upload-sarif@v4 | ||
| with: | ||
| sarif_file: results.sarif |
There was a problem hiding this comment.
Add continue-on-error: true to prevent upload failures from masking actual Checkov security findings when the SARIF file doesn't exist or upload service is unavailable.
| - name: Upload Checkov SARIF report | |
| if: always() | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: results.sarif | |
| - name: Upload Checkov SARIF report | |
| if: always() | |
| continue-on-error: true | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: results.sarif |
Motivation
Description
.github/workflows/platform-iac-ci.ymlto grantsecurity-events: writepermission and to configure Checkov withsoft_fail: false,output_format: cli,sarif, andoutput_file_path: console,results.sarif.github/codeql-action/upload-sarif@v4and a Trivy IaC misconfiguration scan step usingaquasecurity/trivy-action@v0.35.0withscan-type: config,scan-ref: applications/gitops/base,severity: CRITICAL,HIGH, andexit-code: '1'.README.mdpipeline description to mention the new Checkov + Trivy security scans and clarified the CI content to include build/test/synth + security checks.applications/gitops/base/sample-service.yamlby adding a podsecurityContextwithrunAsNonRoot: trueandseccompProfile: type: RuntimeDefaultto align with secure-by-default guardrails.Testing
npm ci,npm run build,npm test -- --ci,npm run synth, Checkov scan (with SARIF output), SARIF upload, and Trivy IaC config scan.mainbranch PR paths and will fail the run on detection of Checkov or Trivy issues due tosoft_fail: falseandexit-code: '1'respectively.Codex Task