awslabs / ar-go-tools

ar-go-tools (Argot) is a collection of analysis tools for Go
Apache License 2.0
25 stars 1 forks source link

Must be static option in backtrace #117

Closed victornicolet closed 1 week ago

victornicolet commented 1 week ago

This PR add the must-be-static option in the slicing specs of the backtrace tool. For example:

dataflow-problems:
  slicing:
    - must-be-static: true
      backtracepoints:
        - package: regexp
           method: MustCompile 

Reports an error only when non-static data reaches a call to regexp.MustCompile.

This PR also changes the behavior of backtrace in general to report an error when any trace is detected. must-be-static is a constraint on which traces are reported; only the non-static ones.

Using the tool without the must-be-static means all traces are reported, and almost guarantees that an error will be shown. This should not be a problem since backtrace without the must-be-static option should only be used as an exploration tool right now.