-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[ResponseOps][Rules] Prevent internally managed rule types to be created from the Rule Create API #230066
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
[ResponseOps][Rules] Prevent internally managed rule types to be created from the Rule Create API #230066
Conversation
|
Pinging @elastic/response-ops (Team:ResponseOps) |
|
@elasticmachine merge upstream |
…sikas/kibana into prevent_creation_internal_rule_types
| const ruleType = ruleTypes.get(createRuleData.rule_type_id); | ||
|
|
||
| /** | ||
| * Throws a bad request (400) if the rule type is internallyManaged |
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.
why 400? I think 403 would be more fitting:
In https://www.rfc-editor.org/rfc/rfc9110#status.403
However, a request might be forbidden for reasons unrelated to the credentials.
| if (ruleType?.internallyManaged) { | ||
| return res.badRequest({ | ||
| body: { | ||
| message: `Cannot create rule of type "${createRuleData.rule_type_id}" because it is internally managed.`, |
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.
shouldn't this message be translated? or is it only messages we show in the ui? nvm
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
History
cc @cnasikas |
…ted from the Rule Create API (elastic#230066) ## Summary This PR prevents internally managed rule types from being created through the Rule Create API. The prevention logic is on he route level because we want to support creating internally managed rules from the alerts client. Fixes: elastic#221382 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…ted from the Rule Create API (elastic#230066) ## Summary This PR prevents internally managed rule types from being created through the Rule Create API. The prevention logic is on he route level because we want to support creating internally managed rules from the alerts client. Fixes: elastic#221382 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
…ted from the Rule Create API (elastic#230066) ## Summary This PR prevents internally managed rule types from being created through the Rule Create API. The prevention logic is on he route level because we want to support creating internally managed rules from the alerts client. Fixes: elastic#221382 ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
This PR prevents internally managed rule types from being created through the Rule Create API. The prevention logic is on he route level because we want to support creating internally managed rules from the alerts client.
Fixes: #221382
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.