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

Fail on conversion attempt of placeholders #138

Closed
thomaspatzke opened this issue Jul 20, 2023 Discussed in #137 · 1 comment
Closed

Fail on conversion attempt of placeholders #138

thomaspatzke opened this issue Jul 20, 2023 Discussed in #137 · 1 comment
Labels
bug Something isn't working

Comments

@thomaspatzke
Copy link
Member

Raise a new exception SigmaPlaceholderError if it is attempted to convert a SigmaString containing an unprocessed placeholder.

Discussed in #137

Originally posted by mostafa July 19, 2023
Hey @thomaspatzke,

I've been working on placeholders and found out that if a placeholder is defined in the rule, and there's no matching transformation in any of the provided pipelines, it'll be regarded as an unknown type and a TypeError is raised. The TypeError is caught by the general Exception block and returned with a generic message:

TypeError: unhashable type: 'Placeholder' (while applying processing pipeline on rule /path/to/some_rule.yml)

This is not very useful, so I suggest we catch the exception and modify this line to consider Placeholder a special object to return NO_VALUE_PROVIDED instead. This way, the query is safely converted, yet the value of the placeholder will be NO_VALUE_PROVIDED. I made two fixes to address this, and they more or less do the same thing:

  1. https://github.com/mostafa/pySigma/tree/meaningful-placeholders-proposal-1
  2. https://github.com/mostafa/pySigma/tree/meaningful-placeholders-proposal-2

I'd be very happy to have your feedback on this. (This look more like an issue, rather than an idea for discussion. 😁)

CC: @kelnage

@thomaspatzke thomaspatzke added the bug Something isn't working label Jul 20, 2023
thomaspatzke added a commit that referenced this issue Jul 30, 2023
Fixes Fail on conversion attempt of placeholders #138
@thomaspatzke
Copy link
Member Author

Fixed!

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

No branches or pull requests

1 participant