-
Notifications
You must be signed in to change notification settings - Fork 6
AST-173242: Improve KICS container engine fallback and remediation flow - #1561
Open
cx-kedar-bhujade wants to merge 6 commits into
Open
AST-173242: Improve KICS container engine fallback and remediation flow #1561cx-kedar-bhujade wants to merge 6 commits into
cx-kedar-bhujade wants to merge 6 commits into
Conversation
- Distinguish "both engines installed but stopped" from a single-engine failure so agent audit logs can surface a clearer error when neither Docker nor Podman is running (container_engine=both). - Add IsEngineInstalled to detect engine presence independent of daemon state. - Return highest severity from ScanFileEdit and use it to log remediation telemetry when a KICS finding blocks a file edit. - Send AI telemetry (finding count) after every KICS scan via logKicsTelemetry. - Thread WorkDir/SessionID through formatFindings and switch ScanFileEdit to take *agenthooks.FileEditEvent.
Contributor
✅ Resolved — a later workflow run passed this policy check.
Original alert (resolved)
Security Policy Alert: Secret Policy Violation
This workflow run has been blocked by StepSecurity's secrets policy because it accesses secrets and the workflow file differs from the default branch.
Secret references detected:
- secrets.CX_BASE_URI at line 203
- secrets.CX_CLIENT_ID at line 204
- secrets.CX_CLIENT_SECRET at line 205
- secrets.CX_BASE_AUTH_URI at line 206
- secrets.CX_AST_USERNAME at line 207
- secrets.CX_AST_PASSWORD at line 208
- secrets.CX_APIKEY at line 209
- secrets.CX_TENANT at line 210
- secrets.CX_SCAN_SSH_KEY at line 211
- secrets.PERSONAL_ACCESS_TOKEN at line 213
- secrets.PROXY_USER at line 216
- secrets.PROXY_PASSWORD at line 217
- secrets.PR_GITLAB_TOKEN at line 222
- secrets.PR_GITLAB_NAMESPACE at line 223
- secrets.PR_GITLAB_REPO_NAME at line 224
- secrets.PR_GITLAB_PROJECT_ID at line 225
- secrets.PR_GITLAB_IID at line 226
- secrets.AZURE_ORG at line 227
- secrets.AZURE_PROJECT at line 228
- secrets.AZURE_REPOS at line 229
- secrets.AZURE_TOKEN at line 230
- secrets.BITBUCKET_WORKSPACE at line 232
- secrets.BITBUCKET_REPOS at line 233
- secrets.BITBUCKET_USERNAME at line 234
- secrets.BITBUCKET_PASSWORD at line 235
- secrets.GITLAB_TOKEN at line 236
- secrets.PR_BITBUCKET_TOKEN at line 238
- secrets.ECHO_LIBRARIES_ACCESS_KEY at line 263
- secrets.MS_TEAMS_WEBHOOK_URL_INTEGRATION_TESTS at line 411
To approve this workflow, please add the workflows-approved label to this PR.
Note: The label must be added by someone other than the PR author (cx-kedar-bhujade) or automation bots to ensure proper security review.
After the label is added, you can re-run the blocked workflow to proceed.
This workflow will be automatically approved once merged into the default branch.
For more information, see StepSecurity's Secret Exfiltration Policy documentation.
- Add a scanFileEditResult test helper to avoid dogsled violations from ScanFileEdit's 5 return values in kics_test.go. - Extract "IaC" and "hooks-remediate" telemetry literals to constants in hooks_test.go (goconst). - Log (instead of silently swallowing) telemetry send failures in logKicsTelemetry (staticcheck SA9003). - Reword errAllEnginesNotRunning so it doesn't end in punctuation (staticcheck ST1005).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens the KICS container-engine fallback (Docker/Podman) with clearer error reporting when both engines are installed but not running, reworks the agent remediation guidance to route every IaC finding through a single MCP flow with skill-driven remediation and explicit suppress commands, and adds AI telemetry for KICS scans and blocked findings.
Changes
Container engine fallback
IsEngineInstalled(presence-only check, independent of daemon state) andbothEnginesInstalledButStopped/scanErrorAfterNoFallbackto detect the "both installed, both stopped" case and surface a clear, actionable error ("Start Docker Desktop or the Podman machine and retry.") instead of a single-engine failure message.Remediation guidance (
kics/delta.go)imageRemediation(Dockerfile/docker-compose) orcodeRemediation(everything else) MCP tools, based on a platform/filename heuristic. Guidance instructed the agent to fix every finding unconditionally, with no suppression path surfaced.codeRemediationonly (the image-specific path and its heuristics were removed). Guidance now:cx-devassist-kics//cx-devassist-kics, agent-specific) that reuses the findings already in context instead of rescanning.cx ignore-vulnerabilitysuppress commands per finding (with--ignored-file-pathand--optional-flagsfor provenance), including a Cursor-specific quoting/PowerShell-safe variant.Telemetry (
kics/kics.go,cx/hooks.go)ScanFileEditnow also returns the highest severity across findings (highestSeverity) and takes*agenthooks.FileEditEventplus awrappers.TelemetryWrapper/agent name.logKicsTelemetry) with the finding count;hooks.goadditionally logs remediation telemetry with severity when an edit is blocked.Testing
go build ./...go test ./internal/commands/agenthooks/... ./internal/services/realtimeengine/iacrealtime/...— all packages pass