Skip to content

Navigation Menu

Sign in
Sign up

AST-173242: Improve KICS container engine fallback and remediation flow - #1561

Open
cx-kedar-bhujade wants to merge 6 commits into
main from
feature/kics-container-engine-fix
Open

AST-173242: Improve KICS container engine fallback and remediation flow #1561
cx-kedar-bhujade wants to merge 6 commits into
main from
feature/kics-container-engine-fix

Conversation

@cx-kedar-bhujade

@cx-kedar-bhujade cx-kedar-bhujade commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

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

  • Before: When the primary engine (Docker/Podman) failed and no fallback engine was configured, the raw underlying error was returned as-is, which could be ambiguous when both engines were installed but neither daemon was running.
  • After: Added IsEngineInstalled (presence-only check, independent of daemon state) and bothEnginesInstalledButStopped/scanErrorAfterNoFallback to 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)

  • Before: Findings were routed to either imageRemediation (Dockerfile/docker-compose) or codeRemediation (everything else) MCP tools, based on a platform/filename heuristic. Guidance instructed the agent to fix every finding unconditionally, with no suppression path surfaced.
  • After: All KICS/IaC findings now go through codeRemediation only (the image-specific path and its heuristics were removed). Guidance now:
    • Points the agent at a dedicated remediation skill (cx-devassist-kics / /cx-devassist-kics, agent-specific) that reuses the findings already in context instead of rescanning.
    • Emits ready-to-run cx ignore-vulnerability suppress commands per finding (with --ignored-file-path and --optional-flags for provenance), including a Cursor-specific quoting/PowerShell-safe variant.
    • For Cursor, changes the flow from "fix everything automatically" to asking the user to choose remediate vs. suppress per finding, with an explicit warning not to suppress just because a change looks intentional.
    • Falls back to instructing the user to reconnect the Checkmarx MCP when the skill/tool isn't available.

Telemetry (kics/kics.go, cx/hooks.go)

  • ScanFileEdit now also returns the highest severity across findings (highestSeverity) and takes *agenthooks.FileEditEvent plus a wrappers.TelemetryWrapper/agent name.
  • Every KICS scan now logs an AI telemetry event (logKicsTelemetry) with the finding count; hooks.go additionally 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

cx-amol-mane and others added 2 commits September 1, 2026 17:32
- 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.

stepsecurity-app Bot commented Sep 7, 2026
edited
Loading

Copy link
Copy Markdown
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /