Tree-sitter | Stack | Fluid Attacks Help

Tree-sitter

Rationale

Tree-sitter is the core library used by Fluid Attacks' scanner. It is critical for reporting Static Application Security Testing (SAST) vulnerabilities to our clients.

The main reasons why we chose it over other alternatives are:

  1. It is Open source.
  2. It provides a low-level approach towards defining language syntaxes, which makes it highly flexible and capable of theoretically parsing any deterministic language.
  3. It is a very popular library for building SAST scanners.
  4. It has a big community that supports parsers for many languages, which greatly helps decreasing complexity.
  5. It can be used via Python.
  6. It allows us to implement our own parsers, increasing flexibility.
  7. Performance is one of its main concerns, which is one of ours as well as vulnerability scans must execute as fast as possible due to both costs and quick feedback.

Alternatives

The following alternatives were considered but not chosen for the following reasons:

Pyparsing

  1. It provides a high-level approach towards defining syntaxes, at the cost of reduced flexibility, which was much more important to us.
  2. It did not support as many built-in parsers.
  3. Its community was smaller.

Usage

We use Tree-sitter as a syntax parser for most of our supported languages.