Creating a Rule from a Search
A search in the console's Observe pages can become a detection rule. dfe-hyperdx creates the rule in the engine and opens it in the console, which keeps no copy of the search and holds no listener for the hand-off.
Flow
- In dfe-hyperdx, the user clicks the Create Rule trigger, and dfe-hyperdx renders the current search to SQL (
POST /dfe/export-sql). - dfe-hyperdx creates the rule through its
POST /dfe/create-ruleroute, which forwards to the engine'sPOST /api/v1/rules/from-hyperdxwith the caller's engine token. - dfe-hyperdx opens
/rules/{id}, the rule's page in the console, in another tab.
The routes are in dfe-hyperdx's packages/api/src/dfe/routers/query-export.ts, and the trigger in packages/app/src/dfe/components/CreateRuleFromSearch/index.tsx.