-
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
PUT /api/detection_engine/rules/prepackaged API endpoint error #133983
Comments
This includes any interaction with the "Endpoint Security" rule actually, e.g. even if simply using PATCH /api/detection_engine/rules in order to add actions to the rule AFTER it has already been deployed by a human in Kibana webUI, the API will respond with exactly the same error about not liking ApiKey based auth for this rule and only this rule. Of the 691 Elastic prebuilt rules it's only this one rule that does this... 690 of them never have an issue. |
Pinging @elastic/security-solution (Team: SecuritySolution) |
Pinging @elastic/security-detections-response (Team:Detections and Resp) |
@colin-stubbs Thank you for opening this issue, appreciate the details! I have a few further questions to answer which might help us to localize the potential bug.
Are you sure that the requests you send to the API directly (from your scripts or Postman) are authorized on behalf of exactly the same user that can successfully install prebuilt rules from the UI? In case of any doubt what user privileges are required to use Security rules, please refer to this page in the docs. It might be helpful if you could share the privileges of the UI user and the API user so we could inspect and compare them.
Could you share your Postman request here so we could check the HTTP headers you use when calling this endpoint? It looks like the endpoint might only support kibana/x-pack/plugins/security/server/authentication/api_keys/api_keys.ts Lines 343 to 368 in d30f367
This is really weird. Let's talk more in order to understand why this happens. Thank you! |
@colin-stubbs Please reopen if this is still an issue for you and you can provide additional info for troubleshooting. |
Kibana version: 8.2.0
Elasticsearch version: 8.2.0
Server OS version: Not applicable, using Elastic Cloud.
Browser version: Not applicable
Browser OS version: Not applicable
Original install method (e.g. download page, yum, from source, etc.): Elastic Cloud
Describe the bug:
Using API endpoint PUT /api/detection_engine/rules/prepackaged returns an error and fails to deploy the "Endpoint Security" rule.
This appears to be related to the rule requiring the creation of the endpoint list as part of the rule, if it does not already exist.
The error returned from that PUT request is simply a HTTP 400 with the following content returned,
When deploying prepackaged rules via the Kibana webUI this error DOES NOT happen, indicating something to do with the active user session allows creation/interaction with the endpoint_list object that is not permitted otherwise via direct API request.
NOTE: We're using Postman to interact with the API and automate deployment and update of detection rules. Postman is using ApiKey based authentication to interact with the API, so my conclusion is that this particular API endpoint accepts ApiKey based auth... but something else that it does internally does not like ApiKey as an acceptable authentication token.
After the "Endpoint Security" rule has been deployed via Kiban webUI the API can be called again without error, e.g. it'll start to return a normal HTTP 200 with content like,
Steps to reproduce:
Expected behavior:
We should simply be able to use PUT /api/detection_engine/rules/prepackaged to install or update all prepackaged rules.
Screenshots (if relevant): Not applicable.
Errors in browser console (if relevant): Not applicable.
Provide logs and/or server output (if relevant): No obvious logged errors.
Any additional context:
The text was updated successfully, but these errors were encountered: