-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Security Solution] Tines connector #143505
Conversation
… into 140066_tines_connector
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
@elasticmachine merge upstream |
@@ -0,0 +1,105 @@ | |||
[role="xpack"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @lcawl
secrets: TinesSecretsSchema, | ||
}, | ||
validators: [{ type: ValidatorType.CONFIG, validator: urlAllowListValidator('url') }], | ||
supportedFeatureIds: [SecurityConnectorFeatureId], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ymao1 Should not it show "Security solution"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we are showing the feature ID category now, which is either Alerting Rules
or Cases
. Since this is available for Security rules, that falls under Alerting Rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I was not aware of that. Thanks for clarifying!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good job with the connector @semd! I left some comments. I tested without any issues. I noticed that when the user first enters to the params form it show an error. This is a bit misleading because the user did not interact with the form yet. Other connectors do not show an error until the user interacts with the form.
x-pack/plugins/stack_connectors/server/connector_types/security/tines/tines.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/security/tines/tines.ts
Show resolved
Hide resolved
|
||
const { emptyField, urlField } = fieldValidators; | ||
|
||
const TinesActionConnectorFields: React.FunctionComponent<ActionConnectorFieldsProps> = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure it fits your needs but you can use the SimpleConnectorForm
defined here x-pack/plugins/triggers_actions_ui/public/application/components/simple_connector_form.tsx
. You can see an example here x-pack/plugins/stack_connectors/public/connector_types/cases/jira/jira_connectors.tsx
x-pack/plugins/stack_connectors/public/connector_types/security/tines/tines_params.test.tsx
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/public/connector_types/security/tines/tines_params.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/security/tines/tines.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/security/tines/tines.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/triggers_actions_ui/public/application/hooks/use_sub_action.test.tsx
Show resolved
Hide resolved
x-pack/plugins/triggers_actions_ui/public/application/hooks/use_sub_action.tsx
Show resolved
Hide resolved
data: tinesWebhookSuccessResponse, | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a test for testing the test
sub action.
FYI I just merged #144736 and this PR will require to add tines into the list within |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few questions. Tested the new changes and things look good though!
x-pack/plugins/stack_connectors/public/connector_types/security/tines/tines.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/public/connector_types/security/tines/tines.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/public/connector_types/security/tines/tines.ts
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/public/connector_types/security/tines/tines_connector.test.tsx
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/public/connector_types/security/tines/tines_params.tsx
Show resolved
Hide resolved
...erting_api_integration/common/fixtures/plugins/actions_simulators/server/tines_simulation.ts
Show resolved
Hide resolved
x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/tines.ts
Outdated
Show resolved
Hide resolved
x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors/tines.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/security/tines/render.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/public/connector_types/security/tines/translations.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/public/connector_types/security/tines/translations.ts
Outdated
Show resolved
Hide resolved
.../test/alerting_api_integration/spaces_only/tests/actions/check_registered_connector_types.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the code and tested locally, all works as expected. This is a very interesting system, good job navigating it and writing this solution. Thanks @semd!
LGTM from Explore team!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you a lot for such a great effort! Tested locally, connector works as described in the document. Code LGTM!
@elastic/mlr-docs could you please take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @semd !
x-pack/plugins/triggers_actions_ui/public/application/hooks/use_sub_action.test.tsx
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
async chunk count
ESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @semd |
Summary
Issue: #140066
Doc: https://docs.google.com/document/d/14BY-6CIin1CUH5bwJJgfrGl37hWO-CeNMdl_35agpvk/edit?usp=sharing
Create a new connector type that offers low friction/low effort approach to augmenting Elastic capabilities with SOAR capabilities of Tines.
Implementation
Tines connector implements subActionConnector. With 4 subActions configured:
stories: Retrieves the User available Story objects from Tines, to render the Story selector options in the params form. It uses the
email
andtoken
authentication headers from the configuration.It is requested only when the form opens and when the connector instance changes.
webhooks: Retrieves the Story available Webhooks objects from Tines, to render the Webhook selector in the params form. It uses the
email
andtoken
authentication headers from the configuration and thestory_id
parameter.There is no filter for
type
in the actions (a.k.a. agents) endpoint, so we have to request all actions and filter them bytype === 'Agents::WebhookAgent'
on our side.It is requested every time the selected story changes.
run: The main action execution. It sends the alerts to the Tines configured webhook, using webhook'
path
andsecret
values. There's no template to render, the data coming from the execution is just pruned (thekibana
entry is removed from allcontext.alerts
) and sent directly using the same format to Tines.test: The test form execution. It ends up calling run but using a parametrized body.
Pagination
Both stories and webhooks subActions need pagination, since Tines do not expose any search endpoint for them. The current hard limit is 100 pages. The
paginatedRequest
function in the connector implementation encapsulates this logic.Testing
1- Create a Tines free account.
2- Create a new Story and attach a Webhook Action to start receiving events.
3- Create an API token
4- Configure the Tines Connector in Kibana using the Tines tenant URL that has been generated in the Tines app, the email used to sign in, and the API token generated. docs
5- Attach the Tines Connector to a Detection Rule, selecting the Story and Webhooks created. docs
6- After each rule execution, events should appear in the Tines webhook action.
Screenshots
Configure a Tines connector
Use the Tines connector
Tines events
Checklist
Delete any items that are not applicable to this PR.