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

cased Sigma modifier #67

Merged
merged 5 commits into from
Jun 12, 2023
Merged

cased Sigma modifier #67

merged 5 commits into from
Jun 12, 2023

Conversation

kelnage
Copy link
Collaborator

@kelnage kelnage commented Jun 12, 2023

Add support for the cased modifier to ensure it generates accurate LogQL queries.

Given the default behavior for LogQL is case-sensitive, this is somewhat simple - but it did require some effort to correctly support in edge cases where pySigma was trying to introduce wildcards.

Test support for the new "|cased" modifier for pySigma, and update
packages to enable it.
Checking for the new SigmaCasedString and treating appropriately. Note,
this class is a subclass of SigmaString, so isinstance(x, SigmaString)
will also return true for it.
When the backend is in case sensitive mode, the cased modifier should
make no difference to its output.

Also, the startswith/endswith/contains modifiers interact with the cased
keyword and also needed testing.
The code added to the pySigma library to handle the cased modifier meant
our overrides were skipped. This fixes the issue by enforcing the call
to convert the str into a regex if the value contains one or more
wildcards.
@kelnage kelnage requested a review from a team as a code owner June 12, 2023 10:30
@github-actions
Copy link

github-actions bot commented Jun 12, 2023

Pull Request Test Coverage Report for Build 5242466898

  • 10 of 10 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 99.782%

Totals Coverage Status
Change from base Build 5242220328: 0.004%
Covered Lines: 457
Relevant Lines: 458

💛 - Coveralls

Copy link
Member

@mostafa mostafa left a comment

Choose a reason for hiding this comment

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

LGTM!

@kelnage kelnage merged commit c05975f into main Jun 12, 2023
9 checks passed
@kelnage kelnage deleted the cased-sensitive-modifier branch June 12, 2023 14:39
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.

None yet

2 participants