Repository navigation
AST-195928 - Add Dev Assist analytics fields to agent-hook telemetry (AST-184026,AST-184125,AST-184127,AST-184129,AST-184131) - #1629
Open
cx-rahul-pidde wants to merge 19 commits into
Conversation
The scan (hooks-detect) and remediation (hooks-remediate) events that `cx hooks` sends now carry the fields the Dev Assist analytics design needs: - agentVersion, cxPluginVersion and pluginType, from the CX_AGENT_VERSION, CX_PLUGIN_VERSION and CX_PLUGIN_TYPE variables the agent plugins set - sessionId, from the session the authentication event stored - repoUrl, from the hook's working directory, with any username, password or token removed - status, and on scans a statusResult of per-severity counts (Critical=n,High=n,Medium=n,Low=n,Info=n) - on remediation, eventAttributes.remediationMode=SelfHealing, aiAgentSessionId and vulnerabilityId (CVE ids for SCA, the rule id for ASCA, the similarity id for KICS, the rule title for secrets) Scan counts now report every detected finding. The severity threshold still decides what is denied, but no longer hides findings from the analytics. The shared logic lives in the new agenthooks/hooktelemetry package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Rahul Pidde <206018639+cx-rahul-pidde@users.noreply.github.com>
This was referenced Nov 26, 2026
Signed-off-by: Rahul Pidde <206018639+cx-rahul-pidde@users.noreply.github.com>
Signed-off-by: Rahul Pidde <206018639+cx-rahul-pidde@users.noreply.github.com>
Signed-off-by: Rahul Pidde <206018639+cx-rahul-pidde@users.noreply.github.com>
Signed-off-by: Rahul Pidde <206018639+cx-rahul-pidde@users.noreply.github.com>
Use <Agent>-CLI labels with Success/Failure status and the design's statusResult messages, send zero-finding scans as v2 detection events, report login failures, attach agent session IDs to package-install events, map ignore subTypes per engine, and fill missing login versions from the plugin context file. Co-authored-by: Cursor <cursoragent@cursor.com>
A signed-out cx has no token, so a failed cx auth login --agent ... could not report itself. The failure is now written to the plugin's state directory (cx_failed_logins.json), and the plugin sends it after the next successful sign-in. Co-authored-by: Cursor <cursoragent@cursor.com>
Restore the auth validate authentication event for the default agent, keep @ in repo URL paths and IPv6 hosts when sanitizing, count only the reported severities in totalCount, require https for the API-key realm (loopback excepted), cap the stored-token lookup on failed logins at 1s, and end kics_test.go with a newline. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Reuse authenticationEventType in the auth validate event, name the repeated plugin-context keys and agent state dirs, check the plugin context file close, and add a containers engine constant. Split the two login telemetry tests into helpers to bring them under the cyclomatic limit, reuse existing constants in the hostenv and hooktelemetry tests, and mark the table-driven test fixtures that repeat values on purpose with nolint:goconst, as predicates_test.go already does. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Name the auth methods, agent labels, ignore subTypes and the two failure reasons that goconst flagged in production code, and mark the new login metadata test helper like the other fixture helpers. The previous lint commit also turned telemetry_test.go and jwt-helper_test.go into CRLF files; put them back to LF so they diff against staging by their real changes only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Rahul Pidde <206018639+cx-rahul-pidde@users.noreply.github.com>
goconst flagged api_key_authentication_failed once the auth method became a constant. Name it and browser_authentication_failed, and use the constant in the two test assertions that repeated it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Rahul Pidde <206018639+cx-rahul-pidde@users.noreply.github.com>
cx-kedar-bhujade
approved these changes
Dec 2, 2026
This branch has not been deployed
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.
By submitting this pull request, you agree to the terms within the Checkmarx Code of Conduct. Please review the contributing guidelines for guidance on creating high-quality pull requests.
Description
The scan (
hooks-detect) and remediation (hooks-remediate) events sent bycx hooksnow carry the fields from the Dev Assist analytics technical design. This stacks on #1615, which adds those fields toDataForAITelemetry; the base isfeature/AST-186973-teleand should be retargeted tostagingonce #1615 merges.Fields added to both events
agentVersion,cxPluginVersion,pluginType: read fromCX_AGENT_VERSION,CX_PLUGIN_VERSIONandCX_PLUGIN_TYPE. The Dev Assist CLI plugins (Claude, Copilot, Gemini, Cursor, Codex) set these before runningcx hooks.sessionId: the session stored by the authentication event (cx_session_id).repoUrl: theoriginremote of the hook's working directory, read with go-git (no process spawn), cached per directory. Every credential is removed (username, password, token, query, fragment); an SCP-style remote becomeshttps://host/path.status:success.Scan events
statusResultholds per-severity counts, e.g.Critical=1,High=2,Medium=0,Low=0,Info=0.totalCountand the counts now cover every detected finding. The severity threshold still decides what is denied, but no longer hides findings from the analytics.Remediation events
eventAttributes.remediationMode=SelfHealingandeventAttributes.aiAgentSessionId.eventAttributes.vulnerabilityId: the denied findings' ids, comma-separated, at most 10. CVE ids for SCA, the rule id for ASCA, the similarity id for KICS, the rule title for secrets. Each guardrail records them when it denies; the remediation event takes and clears them (cx hookshandles one hook event per process).The shared logic is in the new
internal/commands/agenthooks/hooktelemetrypackage. Telemetry stays fail-open: nothing here can change a hook decision.Type of Change
Related Issues
Checklist
Additional Notes
Tested locally:
go build ./...,go vet ./internal/commands/agenthooks/..., andgo testforhooktelemetry,guardrails/...,scaandcxall pass. New tests cover URL sanitizing, severity counts, enrichment from env/config/git, and the finding-id recorder.Open with the design owner: agent label case (
Claude-clivsClaude-CLI) and event type names (hooks-detectvsScan).🤖 Generated with Claude Code