Skip to main content

Cotool + Salesforce

Connect Salesforce to Cotool so agents investigate Setup Audit Trail changes, Login History, and Threat Detection events, and ingest them for detections.

Productivity
Updated

The short answer

Salesforce records admin configuration changes in the Setup Audit Trail, every login attempt in Login History, and, with Shield or Event Monitoring, real-time login, API, report, and threat events. Cotool gives agents tools over these sources and ingests them into its own log store with built-in detections.[1][2][7][8][9]

How it connects: Cotool authenticates with the OAuth 2.0 client credentials flow: a connected app's consumer key and secret are exchanged for an access token issued on behalf of a dedicated integration user, so Cotool sees only what that user can see.[2][12]

What Cotool uses from Salesforce

Setup Audit Trail
Changes admins make in Setup. Each row has an Action code such as PermSetCreate, the Setup Section, a Display description, who made the change, and DelegateUser when an admin acted through Login-As.[7]
Login History
Successful and failed login attempts, with Status (success or the failure reason), SourceIp, LoginType, Application, Browser, Platform, CountryIso, LoginUrl, and the TLS protocol and cipher suite.[8]
Real-time activity events
Real-Time Event Monitoring emits login, logout, Login-As, API, report, and permission set events as platform events, with storage objects such as LoginEvent, ApiEvent, and PermissionSetEventStore.[9]
Threat Detection events
Salesforce Threat Detection raises login anomaly, API anomaly, report anomaly, session hijacking, and credential stuffing events. Session hijacking events compare the current and previous IP address, platform, user agent, screen, and window of a session.[9][10]
SOQL queries
Setup Audit Trail and Login History support query calls, so investigators can filter them with SOQL, for example Login History by LoginTime, UserId, or CountryIso.[7][8]

Detections, hunts, and triage

Triage a session hijacking eventTriage
An agent reads the event's current and previous fingerprint fields and contributing features, then pulls the user's recent Login History to see whether the new IP address and user agent ever logged in on their own.[6][8][10]
Detect risky Setup changesDetection
With the Setup Audit Trail in Cotool, detections flag permission set creation, changes in sections such as Manage Users, and any Setup change made through Login-As, using the Action, Section, and DelegateUser fields.[1][4][7]
Hunt failed logins by country and login typeHunt
A hunt groups Login History failures by CountryIso, LoginType, and SourceIp and joins the results with identity provider sign-ins to see whether failures cluster on one source or spread across many accounts.[5][8]
Watch report and API exportsDetection
API anomaly events score how far a user's API activity departs from their usual pattern and list the contributing features, such as row count, while API and report events record the activity itself, which detections can use to flag bulk data pulls.[4][9][11]

Example query

Query Login History for one windowsql
SELECT UserId, LoginTime, Status, SourceIp, LoginType, CountryIso
FROM LoginHistory
WHERE LoginTime > 2026-11-01T00:00:00.000Z
  AND LoginTime < 2026-11-02T00:00:00.000Z

A SOQL query in the shape Salesforce documents for Login History, returning each attempt's user, time, result, IP address, login type, and country for a time window. Change the timestamps, or filter on UserId or CountryIso, both of which LoginHistory accepts as filters.[8]

Setup and permissions

Create a dedicated user with the Salesforce Integration user license and the Minimum Access - API Only Integrations profile. Then enable the client credentials flow on a connected app and set that user as its Run As user.[12]

PermissionAccess
API EnabledGranted by the Minimum Access - API Only Integrations profile, which also restricts the user to API access.[12]Read
Salesforce API Integration permission set licenseEntitles the integration user to the permissions granted through a dedicated permission set.[12]Read
Monitor Login HistoryLets the integration user read LoginHistory records for all users.[8]Read
View Real-Time Event Monitoring DataRequired, with Shield or Event Monitoring, to read real-time events and Threat Detection stores such as SessionHijackingEventStore.[10][11]Read
  • Real-time events and Threat Detection objects need either the Salesforce Shield or the Event Monitoring add-on subscription.[10][11]
  • The client credentials flow returns no refresh token. The client requests a new access token with its client ID and secret when the old one expires.[12]
  • Salesforce recommends one connected app, one integration user, and one permission set per integration, so each system's requests can be audited and its secret rotated alone.[12]

How Cotool works with Salesforce

  • Cotool added Salesforce in release 0.75.0 alongside Workday, Microsoft Intune, and Doppel, with agent tools, managed log ingestion, and built-in detections.[1]
  • Ingested Salesforce events land in Cotool Logs, where they are searchable and feed scheduled detections. Log ingestion is enabled per stream, separately from connecting the integration.[3]
  • Cotool detections are Python code that can run on logs stored in Cotool or call connected tools directly, so a Salesforce detection can join Login History with other identity data.[4]

FAQ

Which Salesforce license do real-time events and Threat Detection need?
Salesforce real-time events and Threat Detection events need the Salesforce Shield or Event Monitoring add-on, and the reading user needs the View Real-Time Event Monitoring Data permission. Both requirements appear in the access rules of each event object.[10][11]
What does DelegateUser mean in the Salesforce Setup Audit Trail?
DelegateUser in the Salesforce Setup Audit Trail is the Login-As user who performed the Setup action. It is blank when nobody used Login-As, so a filled value shows an admin acting as someone else.[7]

Sources

  1. Changelog (Cotool docs) · accessed November 22, 2026
  2. Integrations (Cotool) · accessed November 22, 2026
  3. Cotool Log Ingest (Cotool docs) · accessed November 22, 2026
  4. Detections are code (Cotool Detect) · accessed November 22, 2026
  5. Threat hunting (Cotool Hunt) · accessed November 22, 2026
  6. Respond to every signal (Cotool Respond) · accessed November 22, 2026
  7. SetupAuditTrail (Salesforce Object Reference) · accessed November 22, 2026
  8. LoginHistory (Salesforce Object Reference) · accessed November 22, 2026
  9. Real-Time Event Monitoring Objects (Salesforce Platform Events Developer Guide) · accessed November 22, 2026
  10. SessionHijackingEventStore (Salesforce Platform Events Developer Guide) · accessed November 22, 2026
  11. ApiAnomalyEvent (Salesforce Platform Events Developer Guide) · accessed November 22, 2026
  12. Invoke REST APIs with the Salesforce Integration User and OAuth Client Credentials (Salesforce Developers Blog) · accessed November 22, 2026

Related integrations

All integrations

Use cases with Salesforce

Related reading

Attackers are scaling with tokens

Cotool helps defenders operate at machine speed. See how security teams are scaling Detection & Response.

Book a demo