oasis-open / cti-pattern-validator

OASIS TC Open Repository: Validate patterns used to express cyber observable content in STIX Indicators

Home Page:https://stix2-patterns.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unclear error message when missing brackets

clenk opened this issue · comments

If the input is missing the surrounding '[' and ']' (ie. the input is just a Comparison Expression, not an Observation Expression or Pattern Expresion), the validator's error message is unhelpful:

$ validate_patterns
Enter a pattern to validate: file-object:hashes.md5 = '79054025255fb1a26e4bc422aef54eb4'
FAIL: Error found at line 1:0. no viable alternative at input 'file-object' 

This message comes from the ANTLR library so it can't easily be changed, but perhaps the validator could check if the input starts with '[' or '([' and print a more user-friendly error message?