Gathering detailed insights and metrics for @datadog/native-iast-rewriter
Gathering detailed insights and metrics for @datadog/native-iast-rewriter
Gathering detailed insights and metrics for @datadog/native-iast-rewriter
Gathering detailed insights and metrics for @datadog/native-iast-rewriter
npm install @datadog/native-iast-rewriter
Typescript
Module System
Min. Node Version
Node Version
NPM Version
97.6
Supply Chain
100
Quality
82.2
Maintenance
100
Vulnerability
100
License
Rust (55.14%)
JavaScript (43.9%)
Dockerfile (0.76%)
TypeScript (0.13%)
Shell (0.07%)
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Total Downloads
203,894,602
Last Day
700,668
Last Week
3,482,134
Last Month
14,865,419
Last Year
125,882,748
Apache-2.0 License
4 Stars
74 Commits
1 Forks
7 Watchers
79 Branches
268 Contributors
Updated on Mar 05, 2025
Minified
Minified + Gzipped
Latest Version
2.8.0
Package Id
@datadog/native-iast-rewriter@2.8.0
Unpacked Size
2.48 MB
Size
758.91 kB
File Count
17
NPM Version
10.8.2
Node Version
20.18.1
Published on
Jan 13, 2025
Cumulative downloads
Total Downloads
2
33
Nodejs native AST rewriter heavily based on Speedy Web Compiler o SWC compiler used to instrument Javascript source files.
+
and +=
, template literals and some String methods1const Rewriter = require('@datadog/native-iast-rewriter') 2 3const rewriter = new Rewriter(rewriterConfig) 4const result = rewriter.rewrite(code, filename)
1 2RewriterConfig { 3 // enable/disable sourceMap chaining - false by default 4 chainSourceMap?: boolean 5 6 // enable/disable comments printing - false by default 7 comments?: boolean 8 9 // establishes the prefix for the injected local variables - 6 random characters by default 10 localVarPrefix?: string 11 12 // sets the list of methods or operators to be rewritten 13 csiMethods?: Array<CsiMethod> 14 15 // extracts hardcoded string literals - true by default 16 literals?: boolean 17} 18 19CsiMethod { 20 // name of the String method to rewrite 21 src: string 22 23 // optional name of the replacement method. If not specified a convention shall be used 24 dst?: string 25 26 // indicates if it is an operator like + 27 operator?: boolean 28}
1const Rewriter = require('@datadog/native-iast-rewriter') 2 3const rewriterConfig = { 4 csiMethods: [{ src: 'substring' }], 5 localVarPrefix: 'test', 6} 7 8const rewriter = new Rewriter(rewriterConfig) 9 10const code = `function sub(a) { 11 return a.substring(1) 12}` 13const result = rewriter.rewrite(code, filename) 14 15console.log(result.content) 16/* 17function sub(a) { 18 let __datadog_test_0, __datadog_test_1; 19 return (__datadog_test_0 = a, __datadog_test_1 = __datadog_test_0.substring, _ddiast.stringSubstring(__datadog_test_1.call(__datadog_test_0, 1), __datadog_test_1, __datadog_test_0, 1)); 20} 21*/
To set up the project locally, you should install cargo
and wasm-pack
:
$ curl https://sh.rustup.rs -sSf | sh
$ cargo install wasm-pack
and project dependencies:
$ npm install
Build the project with
$ npm run build
It will compile WASM binaries by default and then it will be possible to run the tests with
$ npm t
No vulnerabilities found.
No security vulnerabilities found.
Last Day
6.6%
700,668
Compared to previous day
Last Week
-0%
3,482,134
Compared to previous week
Last Month
18%
14,865,419
Compared to previous month
Last Year
75.6%
125,882,748
Compared to previous year