Skip to content
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] Required fields are getting erased on rule PATCH #199665

Closed
Tracked by #174168
xcrzx opened this issue Nov 11, 2024 · 3 comments · Fixed by #199901
Closed
Tracked by #174168

[Security Solution] Required fields are getting erased on rule PATCH #199665

xcrzx opened this issue Nov 11, 2024 · 3 comments · Fixed by #199901
Assignees
Labels
8.17 candidate bug Fixes for quality problems that affect the customer experience Feature:Rule Management Security Solution Detection Rule Management area impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.16.1 v8.17.0 v9.0.0

Comments

@xcrzx
Copy link
Contributor

xcrzx commented Nov 11, 2024

Summary

After sending a PATCH update to any rule that includes the required_fields field, the field is being erased.

For example, I have a prebuilt rule with required fields:

GET /api/detection_engine/rules?id=e9c05e3b-ca79-4d61-bd9a-44995b8f762d
{
    "id": "e9c05e3b-ca79-4d61-bd9a-44995b8f762d",
    "required_fields": [
        {
            "name": "event.action",
            "type": "keyword",
            "ecs": true
        },
       // ...
    ],
  //... other fields
}

I send a PATCH request to update its description:

PATCH /api/detection_engine/rules
{
    "id": "e9c05e3b-ca79-4d61-bd9a-44995b8f762d",
    "description": "Slightly updated description"
}

After the PATCH, I retrieve the rule and find the required fields are missing:

GET /api/detection_engine/rules?id=e9c05e3b-ca79-4d61-bd9a-44995b8f762d
{
    "id": "e9c05e3b-ca79-4d61-bd9a-44995b8f762d",
    "required_fields": [],
  //... other fields
}
@xcrzx xcrzx added bug Fixes for quality problems that affect the customer experience Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team triage_needed labels Nov 11, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@dplumlee dplumlee self-assigned this Nov 13, 2024
@banderror banderror added impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Feature:Rule Management Security Solution Detection Rule Management area v9.0.0 v8.17.0 v8.16.1 labels Nov 13, 2024
@banderror banderror added impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. and removed impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. labels Nov 13, 2024
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Nov 15, 2024
…`PATCH` calls (elastic#199901)

**Fixes elastic#199665

## Summary

Fixes the `required_fields` field being removed from the existing rule
when not present in the rule `PATCH` API call.

### Checklist

Delete any items that are not applicable to this PR.

- [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
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Georgii Gorbachev <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit f716948)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Nov 15, 2024
…`PATCH` calls (elastic#199901)

**Fixes elastic#199665

## Summary

Fixes the `required_fields` field being removed from the existing rule
when not present in the rule `PATCH` API call.

### Checklist

Delete any items that are not applicable to this PR.

- [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
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Georgii Gorbachev <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit f716948)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.17 candidate bug Fixes for quality problems that affect the customer experience Feature:Rule Management Security Solution Detection Rule Management area impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.16.1 v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants