Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [ResponseOps] Granular Connector RBAC - adding API key to event…
… log (#204114) (#204996) # Backport This will backport the following commits from `main` to `8.x`: - [[ResponseOps] Granular Connector RBAC - adding API key to event log (#204114)](#204114) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Alexi Doak","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-19T18:30:15Z","message":"[ResponseOps] Granular Connector RBAC - adding API key to event log (#204114)\n\nPart of https://github.com/elastic/kibana/issues/180908\r\n\r\n## Summary\r\n\r\nThis change is part of adding granular RBAC for SecuritySolution\r\nconnectors. In this PR, I updated the action executor to log API key\r\ndetails when a connector is executed by a user authenticated via API\r\nkey. The public name and id of the API key are now included in the event\r\nlog.\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n### To verify\r\n\r\n1. Create an API key\r\n2. Create a connector that will successfully run, it doesn't have to be\r\nSentinelOne.\r\n3. Run the following with the ID and correct params for your connector\r\ntype.\r\n```\r\ncurl -X POST \"http://localhost:5601/api/actions/connector/$CONNECTOR_ID/_execute\" -H 'Authorization: ApiKey $API_KEY' -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'\r\n{\r\n \"params\": {\r\n \"message\": \"hi\"\r\n }\r\n}'\r\n```\r\n4. Go to dev tools and run the following query to verify that the API\r\nkey information is stored in the event log\r\n```\r\nGET /.kibana-event-log*/_search\r\n{\r\n \"sort\": [\r\n {\r\n \"@timestamp\": {\r\n \"order\": \"desc\"\r\n }\r\n }\r\n ],\r\n \"query\": {\r\n \"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n \"event.provider\": {\r\n \"value\": \"actions\"\r\n }\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n```","sha":"1ba2716c7b00086b35788d7714781b252be1d6a0","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.18.0"],"title":"[ResponseOps] Granular Connector RBAC - adding API key to event log","number":204114,"url":"https://github.com/elastic/kibana/pull/204114","mergeCommit":{"message":"[ResponseOps] Granular Connector RBAC - adding API key to event log (#204114)\n\nPart of https://github.com/elastic/kibana/issues/180908\r\n\r\n## Summary\r\n\r\nThis change is part of adding granular RBAC for SecuritySolution\r\nconnectors. In this PR, I updated the action executor to log API key\r\ndetails when a connector is executed by a user authenticated via API\r\nkey. The public name and id of the API key are now included in the event\r\nlog.\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n### To verify\r\n\r\n1. Create an API key\r\n2. Create a connector that will successfully run, it doesn't have to be\r\nSentinelOne.\r\n3. Run the following with the ID and correct params for your connector\r\ntype.\r\n```\r\ncurl -X POST \"http://localhost:5601/api/actions/connector/$CONNECTOR_ID/_execute\" -H 'Authorization: ApiKey $API_KEY' -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'\r\n{\r\n \"params\": {\r\n \"message\": \"hi\"\r\n }\r\n}'\r\n```\r\n4. Go to dev tools and run the following query to verify that the API\r\nkey information is stored in the event log\r\n```\r\nGET /.kibana-event-log*/_search\r\n{\r\n \"sort\": [\r\n {\r\n \"@timestamp\": {\r\n \"order\": \"desc\"\r\n }\r\n }\r\n ],\r\n \"query\": {\r\n \"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n \"event.provider\": {\r\n \"value\": \"actions\"\r\n }\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n```","sha":"1ba2716c7b00086b35788d7714781b252be1d6a0"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204114","number":204114,"mergeCommit":{"message":"[ResponseOps] Granular Connector RBAC - adding API key to event log (#204114)\n\nPart of https://github.com/elastic/kibana/issues/180908\r\n\r\n## Summary\r\n\r\nThis change is part of adding granular RBAC for SecuritySolution\r\nconnectors. In this PR, I updated the action executor to log API key\r\ndetails when a connector is executed by a user authenticated via API\r\nkey. The public name and id of the API key are now included in the event\r\nlog.\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following conditions. \r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n### To verify\r\n\r\n1. Create an API key\r\n2. Create a connector that will successfully run, it doesn't have to be\r\nSentinelOne.\r\n3. Run the following with the ID and correct params for your connector\r\ntype.\r\n```\r\ncurl -X POST \"http://localhost:5601/api/actions/connector/$CONNECTOR_ID/_execute\" -H 'Authorization: ApiKey $API_KEY' -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'\r\n{\r\n \"params\": {\r\n \"message\": \"hi\"\r\n }\r\n}'\r\n```\r\n4. Go to dev tools and run the following query to verify that the API\r\nkey information is stored in the event log\r\n```\r\nGET /.kibana-event-log*/_search\r\n{\r\n \"sort\": [\r\n {\r\n \"@timestamp\": {\r\n \"order\": \"desc\"\r\n }\r\n }\r\n ],\r\n \"query\": {\r\n \"bool\": {\r\n \"filter\": [\r\n {\r\n \"term\": {\r\n \"event.provider\": {\r\n \"value\": \"actions\"\r\n }\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n```","sha":"1ba2716c7b00086b35788d7714781b252be1d6a0"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Alexi Doak <[email protected]>
- Loading branch information