datadog-static-analyzer
datadog-static-analyzer copied to clipboard
[STAL-1886] JavaScript -> Rust Proof of Concept
NOTE: Despite CI failures: this is a fully working proof of concept, but kept as a draft
To run:
- Create an empty directory to test this repo.
- In this repo, create a TypeScript file with a variable assignment to the string "hello". For example:
echo 'let foo = "hello"\nlet bar = "world"' > index.ts - Run the analyzer, pointing it to this directory:
cargo run --bin datadog-static-analyzer -- --format sarif --output result.sarif --directory ~/sandbox - You'll see the result of the Rust function call printed in stdout:
What problem are you trying to solve?
Demonstrate that we can call into Rust from JavaScript to perform expensive tree-based operations.
What is your solution?
Quick and messy prototype that shows ability to pass tree_sitter::Tree into a Rust function that can be called from from the JavaScript runtime.
This function counts the number of named nodes in the file's tree.
Alternatives considered
What the reviewer should know
- Just a sketch, no consideration given to code organization.
- CI only fails because I circumvented standard operation to make the POC run without config
Datadog Software Composition Analysis
No vulnerabilities found.
Closing, as ddsa supplants this