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] Prebuilt rule status API endpoint returns incorrect total number of prebuilt rules #152836

Closed
Tracked by #174167
banderror opened this issue Mar 7, 2023 · 4 comments · Fixed by #154571
Assignees
Labels
8.8 candidate bug Fixes for quality problems that affect the customer experience Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules impact:high Addressing this issue will have a high 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.

Comments

@banderror
Copy link
Contributor

Found here: #148392 (comment)
Related to: #148182

Summary

As found by @xcrzx:

There's an error somewhere in the total number of prebuilt rules calculations. I have all rules installed, and one of them is outdated. That's what I get from the status endpoint:

{
    "status_code": 200,
    "message": "OK",
    "attributes": {
        "stats": {
            "num_prebuilt_rules_total": 756,
            "num_prebuilt_rules_installed": 757,
            "num_prebuilt_rules_to_install": 0,
            "num_prebuilt_rules_to_upgrade": 1,
            "rule_ids_to_install": [],
            "rule_ids_to_upgrade": [
                "000047bb-b27a-47ec-8b62-ef1a5d2c9e19"
            ]
        }
    }
}

num_prebuilt_rules_total should be 757.

@banderror banderror added Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detection Rule Management Security Detection Rule Management Team Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules 8.8 candidate labels Mar 7, 2023
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

@banderror banderror added bug Fixes for quality problems that affect the customer experience impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. labels Mar 7, 2023
@xcrzx
Copy link
Contributor

xcrzx commented Apr 17, 2023

After further investigation, it appears that the total number of prebuilt rules could be less than the number of installed prebuilt rules. This occurs when a newer package has previously deprecated rules removed. For example, here's what I get locally with a fairly old rules package installed:

{
    "status_code": 200,
    "message": "OK",
    "attributes": {
        "stats": {
            "num_prebuilt_rules_total": 679,
            "num_prebuilt_rules_installed": 754,
            "num_prebuilt_rules_to_install": 4,
            "num_prebuilt_rules_to_upgrade": 4
        }
    }
}

So, it is not a bug. Nevertheless, the response fields could be confusing. The num_prebuilt_rules_total naming might imply that this is the total number of prebuilt rules (installed + available), but in fact, it is the number of prebuilt rules in the latest package. Probably, we need to rename the field accordingly.

@xcrzx
Copy link
Contributor

xcrzx commented Apr 17, 2023

We've discussed this issue during a group sync and decided to remove the num_prebuilt_rules_total for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.8 candidate bug Fixes for quality problems that affect the customer experience Feature:Prebuilt Detection Rules Security Solution Prebuilt Detection Rules impact:high Addressing this issue will have a high 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants