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
Guardium rel 1.10 #958
Guardium rel 1.10 #958
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #958 +/- ##
===========================================
- Coverage 64.72% 64.65% -0.07%
===========================================
Files 517 517
Lines 48597 48804 +207
===========================================
+ Hits 31452 31554 +102
- Misses 17145 17250 +105
Continue to review full report at Codecov.
|
DEFAULT_DAYS_BACK = 2 | ||
|
||
|
||
class QueryStringPatternTranslator: | ||
# Change comparator values to match with supported data source operators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the comparator_lookup, it's not needed since they are now defined in operators.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the comparator_lookup.
|
||
def __init__(self, pattern: Pattern, data_model_mapper, options, transformers): | ||
self.dmm = data_model_mapper | ||
self.comparator_lookup = self.dmm.map_comparator() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to remain since the comparator_lookup is now defined in the data model mapper rather than calling on the comparator_lookup
dictionary at the top of the query_constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done the change.
@@ -513,7 +596,7 @@ def _parse_expression(self, expression, qualifier=None) -> str: | |||
# Multiple data source fields may map to the same STIX Object | |||
mapped_fields_array = self.dmm.map_field(stix_object, stix_field) | |||
# Resolve the comparison symbol to use in the query string (usually just ':') | |||
comparator = self.comparator_lookup[str(expression.comparator)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done the change.
@@ -551,7 +635,7 @@ def _parse_expression(self, expression, qualifier=None) -> str: | |||
return "{}".format(comparison_string) | |||
|
|||
elif isinstance(expression, CombinedComparisonExpression): | |||
operator = self.comparator_lookup[str(expression.operator)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep as is. This line shouldn't have been changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done the change.
@@ -569,15 +653,17 @@ def _parse_expression(self, expression, qualifier=None) -> str: | |||
return self._parse_expression(expression.comparison_expression, qualifier) | |||
elif hasattr(expression, 'qualifier') and hasattr(expression, 'observation_expression'): | |||
if isinstance(expression.observation_expression, CombinedObservationExpression): | |||
operator = self.comparator_lookup[str(expression.observation_expression.operator)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done the change.
elif isinstance(expression, CombinedObservationExpression): | ||
operator = self.comparator_lookup[str(expression.operator)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you are using the old way of defining the comparator lookup rather than relying on the operators.json file. The comparator_lookup is part of the data model mapper and is defined with self.comparator_lookup = self.dmm.map_comparator()
I have worked on the comments and done with the changes. Please check. |
Update Guardium connector to use the STIX IN operator in queries.
No description provided.