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

CDB list input validation #1261

Merged
merged 9 commits into from
Feb 16, 2022
Merged

Conversation

AlexRuiz7
Copy link
Member

@AlexRuiz7 AlexRuiz7 commented Feb 14, 2022

Summary

Closes #1252

This PR adds input data validation for the CDB lists.

  • Validates the CDB list name by using this regular expression: ^[\\w\\.\\-]+$
  • Validates the CDB key:value pairs
    • Keys: ?:^"([\\w\\-:]+?)"|^[^:"\\s]+$)
    • Values: (?:^"([\\w\\-:]*?)"$|^[^:"]*$)

This PR also renames the CDB List navigation item from 'Lists' to 'CDB Lists' to make it more descriptive and consistent with the Kibana App.

To test

  • Check that the navigation item to go to the CDB lists is named as 'CDB Lists' across all subsections of the Ruleset section.
  • Check that CDB list with invalid name cannot be created.
    • Can only contain alphanumeric characters, dots (.), hyphens (-) and underscores (_).
  • Check that no key:pair value can be created using an invalid key (invalid values are replaced with an empty string).

Makes it consistent with the Kibana App
@AlexRuiz7 AlexRuiz7 added the 4.3 label Feb 14, 2022
@AlexRuiz7 AlexRuiz7 self-assigned this Feb 14, 2022
@AlexRuiz7 AlexRuiz7 linked an issue Feb 14, 2022 that may be closed by this pull request
@AlexRuiz7 AlexRuiz7 marked this pull request as ready for review February 15, 2022 10:52
Copy link
Member

@asteriscos asteriscos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beware CBD list throws an error when it has a . character and the input validation allows it.

image

@AlexRuiz7 AlexRuiz7 changed the title CBD list input validation CDB list input validation Feb 16, 2022
Copy link
Member

@asteriscos asteriscos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: ✔️
Test: ✔️

Copy link
Member

@Desvelao Desvelao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review

Test ❌

I found some things that I am not sure if there is a problem:

  • The value seems can't contain spaces, but there is built-in list with values with spaces, for example aws-eventnames
    image
    image

@Machi3mfl
Copy link
Member

Possible improvement:
Screen Shot 2022-02-16 at 13 44 56

Change the "Add new entry" style when is disabled.

@Machi3mfl Machi3mfl self-requested a review February 16, 2022 16:46
Copy link
Member

@Machi3mfl Machi3mfl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR ✅
Test ✅

@AlexRuiz7 AlexRuiz7 merged commit 8df0592 into 4.3-8.2 Feb 16, 2022
Copy link
Member

@Desvelao Desvelao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review:
Test ✅

@AlexRuiz7 AlexRuiz7 deleted the bugfix/1252-cbd-list-input-validation branch February 17, 2022 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CDB List should validate white spaces in keys
4 participants