Skip to content

Conversation

@RagingRedRiot
Copy link
Contributor

@RagingRedRiot RagingRedRiot commented Dec 10, 2025

Darktrace Adapter

New Darktrace adapter for ingesting security alerts and model breach events from Darktrace's API.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Note

Add Darktrace adapter and wire it into config and runner to ingest AI Analyst and Model Breach events.

  • Adapters:
    • New darktrace adapter (darktrace/client.go): polls AI Analyst and Model Breach endpoints with time-windowed queries, HMAC auth/signing, dedupes via SHA-256 log hashing, handles 429 backoff, and ships events to USP with configurable initial lookback and graceful shutdown.
  • Configuration & Runner:
    • Register DarktraceConfig in containers/conf/all.go.
    • Wire darktrace into containers/general/tool.go to construct and run the adapter with standard client options.

Written by Cursor Bugbot for commit 953e1b5. This will update automatically on new commits. Configure here.

@maximelb
Copy link
Contributor

/gcbrun

Copy link
Contributor

@maximelb maximelb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review comments with suggestions

- Fix silent error loss in submitEvents when Ship() returns non-BufferFull error
- Remove duplicate error logging in doRequest for non-200 responses
- Use correct context (rootCtx) for USP client initialization
- Rename DarkTraceAdapter to DarktraceAdapter for consistent naming
- Rename doWithRetry to doRequest (only retries on 429)
- Remove trailing whitespace
- Add newline at end of file

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

amrik-lc
amrik-lc previously approved these changes Dec 11, 2025
The InitialLookback field intentionally defaults to zero, meaning
the adapter starts fetching events from the current moment forward
with no historical lookback. This is the desired behavior as adapters
run ephemerally and lookback is mainly for manual backfill jobs.

Add a comment to document this intentional default behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@maximelb
Copy link
Contributor

/gcbrun

if len(items) > 0 {
since[api.Key] = cycleTime.Add(-queryInterval * time.Second)
allItems = append(allItems, items...)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Query timestamp never advances during quiet periods

The since timestamp is only updated when events are returned (len(items) > 0). During quiet periods with no new events, the since timestamp never advances, causing the query time window to grow indefinitely. Each subsequent poll queries from the original since to the current time, potentially fetching increasingly large time ranges. The timestamp update needs to happen unconditionally after a successful fetch to ensure time progression even when no events are found.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants