feat(integration-crowdstrike): endpoint block event poller (Stage 1) - #58
Draft
KunalSin9h wants to merge 2 commits into
Draft
KunalSin9h wants to merge 2 commits into
KunalSin9h wants to merge 2 commits into
Conversation
Add `safedep integration crowdstrike run`, a cursor-based poller that streams SafeDep endpoint package-guard block events and logs them. - Source: EndpointManagementService.ListEndpointPackageGuardEvents over the control plane (a.ControlPlane, OAuth), filtered to PACKAGE_DECISION with BLOCKED and COOLDOWN_BLOCKED actions, ascending by event time. - Cursor: profile-scoped KV watermark on event.Timestamp with EventId boundary dedup (TimeRange.Start inclusivity is undocumented). TimeRange requires both Start and End, so End is capped at now per drain. - Sink is a port (eventSink) with a printClient adapter that logs each event (JSONL under -o json, human line otherwise). A crowdstrikeClient SIEM-push adapter is Stage 2: swap the adapter, nothing else changes. - Mirrors the jfrog integration patterns (reporter, cursor store, poll loop, cursor set/remove verbs); jfrog is untouched. Docs, README links, and a design spec included. Tests cover request shape, paging, cursor advance + dedup, backfill, and error mapping. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
Explain that next_page_token is a within-cycle paging cursor only, while TimeRange.Start is the client-maintained cross-cycle freshness cursor, and why a Timestamp watermark is correct for immutable append-only events. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds
safedep integration crowdstrike run, a cursor-based poller that streams SafeDep endpoint package-guard block events and, in this stage, logs them. Two signals, treated as one stream tagged byaction:PmgPackageAction.BLOCKED)PmgPackageAction.COOLDOWN_BLOCKED)This is Stage 1 (poll + log). Stage 2 (push to CrowdStrike SIEM) and Stage 3 are future work — the sink is a port from day one, so Stage 2 is a new adapter plus one wiring line.
How
EndpointManagementService.ListEndpointPackageGuardEventsover the control plane (a.ControlPlane(), OAuth), the same service thesafedep endpointcommands use. Filtered server-side toPACKAGE_DECISION+ the two block actions, ascending by event time.event.TimestampwithEventIdboundary dedup (the API doesn't documentTimeRange.Startinclusivity, so we're correct either way).TimeRangerequires bothStartandEndand rejectsstart >= end, soEndis capped atnowper drain.eventSink):printClientadapter logs each event — JSONL on stdout under-o json, human line on stderr otherwise. Swapping in acrowdstrikeClient(Stage 2) changes nothing in the source/service/cursor.cursor set/removeverbs). jfrog is untouched (copied the small generic pieces rather than refactor a shipped feature).Auth
Control-plane OAuth:
safedep auth login(device flow). An API-key-only login does not work for this service.Tests / checks
go build ./...,go vet,golangci-lint(0 issues), and the fullinternal/cmd/...suite incl. the cobra convention tests — all green.EventIddedup, backfill, first-run anchor, PermissionDenied→not-entitled, Unauthenticated→auth error, callback-error wrap, infra-retry, and event→JSON/human mapping for both actions.Notes for reviewers
docs/integration-crowdstrike-spec.mdis the design record (staging, decisions, open items).🤖 Generated with Claude Code