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

Empty rules files may lead to a broken manager #2891

Closed
BraulioV opened this issue Feb 2, 2021 · 5 comments
Closed

Empty rules files may lead to a broken manager #2891

BraulioV opened this issue Feb 2, 2021 · 5 comments
Assignees
Labels
type/bug Bug issue

Comments

@BraulioV
Copy link

BraulioV commented Feb 2, 2021

Wazuh Elastic Rev
4.1.0 7.10.0 4101-1

Description
At the moment, a manager doesn't allow an empty local_rules.xml file. Analysisd can't read it and report a configuration error if it is empty.

If a user deletes the content of the local_rules.xml file and saves it, the app updates the file but it doesn't restart the manager and shows a "warning/error" message:
image

IMO, the app shouldn't allow this behavior. It already checks if there're errors in the configuration file and it prevents saving it so it should check if the file is empty or not too. If someone else deletes the content and save it, the next time it tries to restart the manager it will fail.

Steps to reproduce

  1. Go to Management > Rules > Custom rules > local_rules.xml.
  2. Delete the content of the file.
  3. Save it.
@BraulioV BraulioV added the type/bug Bug issue label Feb 2, 2021
@frankeros frankeros added this to the Sprint 124 - WUI milestone Feb 2, 2021
@sortiz1191 sortiz1191 self-assigned this Feb 2, 2021
@davidfmiranda
Copy link

Hello @BraulioV. This behavior also happens when creating a new rules file.

Regards,

David

@sortiz1191
Copy link
Contributor

Check the error and find it in the code.

@sortiz1191
Copy link
Contributor

Saving current file content for restore if validation fails.

@sortiz1191
Copy link
Contributor

Edit file. Check for invalid file content:

  • If the file is invalid, restore previous content and save the file again.

@sortiz1191
Copy link
Contributor

Check if the file is new or is editing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bug issue
Projects
None yet
Development

No branches or pull requests

4 participants