mozilla / scanjs

[DEPRECATED] Static analysis tool for javascript code.
Other
429 stars 39 forks source link

Support for longer rules (e.g. foo.bar.baz) #157

Closed pauljt closed 2 years ago

pauljt commented 9 years ago

@zombie raised this in issue #80: rules can only have an object name and a property name. Longer specifiers are not supported, and its a little confusing.

E.G The rule "foo.bar" matches: foo.bar a.foo.bar foo.bar.b a.b.foo.bar.c ...etc

I'm not sure how useful longer rules are but the current situation is a little confusing. We should either:

I started an approach of searching on AST trees, i.e. you generate AST from the rule, and then match the entire tree. But it gets super complicated very quickly and Im not sure how useful this is. At this stage I'm considering abandoning the "javascript-like" rule format and going back to explicit rules, just to make tool usage more clear...

zombie commented 9 years ago

i would add an in-between option:

i know programmers are wired to always go: [1, 2, -> n], but it's plausible that just one more level would cover 95% of the usecases..