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

Brackets check doesn't account for arbitrary nested parentheses

chisholm opened this issue · comments

There is code to add a simpler error message in one particular case: when the user has forgotten square brackets around the pattern. But it is too specific: it requires that patterns start with either [ or ([:

if not (start[0] == '[' or start == '(['):

Patterns can have arbitrarily nested structure, so the pattern can start with an arbitrary number of open parentheses. The check needs to be generalized.