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

Repeat Negative Times

varnerac opened this issue · comments

$ validate-patterns
Enter a pattern to validate: [ipv4-addr:value = '198.51.100.1/32'] REPEATS -5 TIMES

PASS: [ipv4-addr:value = '198.51.100.1/32'] REPEATS -5 TIMES

I don't think something should be allowed to repeat a negative number of times.

Thanks for opening this, @varnerac and sorry for not seeing it right away. I'll need to check whether this is technically allowed by the spec; if so, we probably shouldn't invalidate it here. I agree that the pattern doesn't make sense semantically :-)

From the spec:

x MUST be a positive integer.

So yes, we should prevent that in the validator if possible :-)

Thanks, @varnerac

@varnerac This should be fixed now, but if not, feel free to reopen.