Add typescript target support
What does this MR do and why?
Static reachability generates target files for semgrep to specify which files semgrep should scan and with what semgrep analyzer. Currently, all javascript and typescript files are target using the javascript analyzer. This causes exceptions when scanning typescript files.
This MR adds functionality for marking typescript files with typescript analyzers.
The targeting functionality uses SupportedLangTypes to specify analyzer values per extension. We extract .ts from the javascript key and move it to a typescript key.
This has a side effect because SupportedLangTypes is also used by FilterSrFindings which is called from javascript.go using just its Language const, set to javascript, so it would not filter .ts files. To support this, we add a supportedLanguages var to javascript.go and iterate over it to filter for javascript and typescript findings, then we join the lists.
Tests
- Job before change (note the exception)
- Job after change
Related issues
Static Reachability: Support different target f... (gitlab-org/gitlab#555044 - closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After |
|---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.