-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Describe the bug
When a STIX pattern contains a mix of mappable and unmappable properties, STIX Shifter translates and executes the query without raising an error, even though parts of the query will have no effect due to the missing mappings. This can lead to incomplete or inaccurate results.
To Reproduce
- Use a STIX Shifter module (e.g., Elastic ECS) that lacks a mapping for a specific STIX property (e.g.,windows-event-log:event_id).
- Execute a translation with a query that includes both mappable and unmappable properties. For example:
stix-shifter translate elastic_ecs query {} "[windows-event-log:event_id = '4726'] AND [user-account:account_login = 'admin']" "{"validate_pattern":"true","time_range":1000}"
Expected behavior
STIX Shifter should:
Throw an error: Clearly indicate that a portion of the query cannot be mapped to the target data source just as it does when trying to translate with a query that is only using the unmmap properties.
List unmapped properties: Ideally, the error message should specify which STIX objects and properties could not be mapped.
Desktop (please complete the following information):
- OS: Ubuntu 22.04.3 LTS
- STIX Shifter version: 7.0.11
Actual behavior
- STIX Shifter silently ignores the unmappable part of the query ([windows-event-log:event_id = '4726'] in the example) and returns a translated query that only includes the mappable part. No error or warning is provided to the user.
- 2024-07-29 13:39:21,845 stix_shifter_modules.elastic_ecs.stix_translation.query_translator
INFO Converting STIX2 Pattern to data source query
{
"queries": [
"(user.name : "administrator" OR user.name : "admin") AND (@timestamp:["2024-07-28T18:59:21.845Z" TO "2024-07-29T11:39:21.845Z"])"
]
}
Impact
Incomplete Results: Users might unknowingly retrieve incomplete data, as the unmapped filter criteria are not applied.
Difficult Debugging: The lack of error messages makes it challenging to identify and troubleshoot mapping issues, potentially leading to wasted time and effort.
Additional context
This behavior makes it difficult for users to trust the completeness and accuracy of translated queries. Enhanced error reporting and handling of unmapped properties are crucial for improving the reliability and usability of STIX Shifter.