Skip to content

Conversation

@cnasikas
Copy link
Member

@cnasikas cnasikas commented Jul 31, 2025

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.

@cnasikas cnasikas self-assigned this Jul 31, 2025
@cnasikas cnasikas added Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes labels Jul 31, 2025
@cnasikas cnasikas requested a review from a team as a code owner July 31, 2025 12:21
@cnasikas cnasikas added backport:skip This PR does not require backporting Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.2.0 labels Jul 31, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@cnasikas cnasikas changed the title [ResponseOps][Rules] Prevent internally managed rule types to be created from the Rule create API [ResponseOps][Rules] Prevent internally managed rule types to be created from the Rule Create API Jul 31, 2025
@cnasikas
Copy link
Member Author

cnasikas commented Aug 3, 2025

@elasticmachine merge upstream

@cnasikas cnasikas requested a review from a team as a code owner August 4, 2025 11:04
const ruleType = ruleTypes.get(createRuleData.rule_type_id);

/**
* Throws a bad request (400) if the rule type is internallyManaged
Copy link
Contributor

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.`,
Copy link
Contributor

@jcger jcger Aug 4, 2025

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

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #73 / Agents fleet_agents_status should return incoming data status for specified agents

Metrics [docs]

✅ unchanged

History

cc @cnasikas

@cnasikas cnasikas merged commit 43f5cb3 into elastic:main Aug 4, 2025
13 checks passed
@cnasikas cnasikas deleted the prevent_creation_internal_rule_types branch August 4, 2025 13:14
szaffarano pushed a commit to szaffarano/kibana that referenced this pull request Aug 5, 2025
…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>
delanni pushed a commit to delanni/kibana that referenced this pull request Aug 5, 2025
…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>
@wildemat wildemat mentioned this pull request Aug 7, 2025
10 tasks
NicholasPeretti pushed a commit to NicholasPeretti/kibana that referenced this pull request Aug 18, 2025
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent significant event rules from being created via the alerting HTTP API

5 participants