mirror of
https://github.com/beenuar/AiSOC.git
synced 2026-11-24 08:35:46 +08:00
Adds `withsecure_elements`, an EDR connector for WithSecure Elements Broad Context Detections (BCDs), read through the Elements API. Part of the connector wishlist in #356. Authentication is the documented OAuth2 client credentials flow: the API client's ID and secret are exchanged with HTTP Basic at POST /as/token.oauth2 for a token scoped to connect.api.read only. The host is fixed at api.connect.withsecure.com, so the vaulted secret can only ever reach WithSecure, and every request carries the User-Agent the API requires. The token is cached until a minute before expires_in; a cached token refused with 401 is exchanged once more, while a token issued for that same request and refused fails the poll rather than looping. An optional organization ID (validated as a UUID, refused with 422 otherwise) lets a partner account read a customer organization. The poll reads GET /incidents/v1/incidents by createdTimestampStart / createdTimestampEnd, oldest first, 50 a page, and follows nextAnchor through the shared read_token_pages. A BCD is updated whenever a detection joins it, so windowing on creation raises each BCD once. The window opens at the persisted createdTimestamp cursor, the same event-time watermark eset_protect and wazuh use, so a poll cut short by the page bound or a run of failed polls is caught up. A refused or unreachable opening request raises; a later page failing keeps what was read. BCDs WithSecure closed itself as merged, autoFalsePositive or autoAcceptedBehavior are dropped. `archived` is deliberately not filtered on, since WithSecure does not document when a BCD is archived. Each BCD is enriched from its newest 100 detections (GET /incidents/v1/detections) and the devices they name (GET /devices/v1/devices): process, command line, hash (labelled SHA-1 or SHA-256 only when it has that shape), user, host, addresses, OS, and every MITRE ATT&CK technique and tactic. The host columns always describe the device the alert is filed on. The detections and device records ride on the BCD so a replay normalizes the same; each detection is stored without its open-ended activityContext, which keeps the event bounded, since an event ingest refuses would be re-read on every poll. Lookups go to the most severe BCDs and each BCD's own host first, and are bounded (50 BCDs, 50 devices) so a whole poll stays well under WithSecure's documented 300 requests a minute for EDR endpoints. A 429, or a credential refused part-way through, stops the lookups; a failed lookup costs the context, never the BCD. WithSecure's five severity levels each keep their own tier, critical included; a BCD without one falls back to riskLevel, whose top level severe maps to critical. Anything undocumented carries no severity. ocsf_classes.go files withsecure_elements at 2001 Security Finding. Adds the plugin manifest, a docs page with setup, rate limit and troubleshooting notes, a CHANGELOG entry, the checkpoint-contract entry, and the regenerated connector count, types, docs, sidebar, catalog fallback, conformance matrix, marketplace index, llms.txt and corpus stats. Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>