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

Fixing backend options parsing for sigma-cli #78

Merged
merged 3 commits into from
Aug 9, 2023

Conversation

kelnage
Copy link
Collaborator

@kelnage kelnage commented Aug 8, 2023

One of the primary methods for using pySigma-backend-loki is via sigma-cli. This supports backend options, but passes through the arguments as string values, not the types specified in the backend itself. This meant that to set case_insensitive to False, a user must provide the empty string (as that is the only Python string value that evaluates as False) and if -O add_line_filters=false was provided as an argument to sigma-cli, it would still attempt to add line filters, neither of which would likely be the expected or desired behaviour.

This PR fixes the issue, introducing a simple coercion for those string values (case-insensitive comparison for each boolean value to true), and adds a corresponding unit test.

sigma-cli provides all backend options as strings, rather than the types
specified in the backend __init__ function. This changes the code to
reflect that possibility and adds simple coercion for string values into
booleans.
Also update another dependency
@kelnage kelnage requested a review from a team as a code owner August 8, 2023 16:58
@kelnage kelnage self-assigned this Aug 8, 2023
@kelnage kelnage added the bug Something isn't working label Aug 8, 2023
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!

Copy link
Contributor

@romain-gaillard romain-gaillard left a comment

Choose a reason for hiding this comment

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

LGTM!

Edit: Oh, didn’t notice Mostafa had already approved 😅

@kelnage kelnage merged commit 452aa0d into main Aug 9, 2023
9 checks passed
@kelnage kelnage deleted the backend-options-parsing branch August 9, 2023 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants