DataDog / datadog-static-analyzer

Datadog Static Analyzer
https://docs.datadoghq.com/static_analysis/
Apache License 2.0
100 stars 12 forks source link

MJS files unrecognized as Javascript #529

Open twelvelabs opened 1 day ago

twelvelabs commented 1 day ago

Describe the bug

datadog-static-analyzer does not recognize MJS files - even if explicitly including them via config.

To Reproduce

Steps to reproduce the behavior:

  1. Download the latest linux build. I used https://github.com/datadog/datadog-static-analyzer/releases/latest/download/datadog-static-analyzer-$(uname -m)-unknown-linux-gnu.zip
  2. Create a directory containing javascript files using the .mjs file extension, which is used by Node to distinguish JS files using the ES6 module system. Note, I did not try it, but I suspect this is an issue w/ .cjs files as well.
  3. Create static-analysis.datadog.yml:
rulesets:
  - javascript-best-practices
  - javascript-code-style
  - javascript-common-security
  - javascript-node-security

only:
  - "**/*.mjs"
  1. Run datadog-static-analyzer --directory . --print-violations --debug yes --format json --output output.json
  2. Debug output shows files are not scanned.
  3. Rename .mjs files to .js and re-run.
  4. Files are correctly scanned.

Expected behavior

I expected the files to be scanned as javascript... or a config option that allowed me to specify that MJS files should be scanned as javascript.

Desktop (please complete the following information):

juli1 commented 14 hours ago

thank you for the report. we will address this issue in the coming days.