-
Notifications
You must be signed in to change notification settings - Fork 0
/
IastStarter.js
38 lines (33 loc) · 1.02 KB
/
IastStarter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//IASTIGNORE
/*
* ****************************************************
* Licensed Materials - Property of HCL.
* (c) Copyright HCL Technologies Ltd. 2017, 2024.
* Note to U.S. Government Users *Restricted Rights.
* ****************************************************
*/
'use strict'
const fs = require('fs')
const path = require('path')
const acorn = require('acorn')
const walk = require('walk');
const options = {
followLinks: false
};
const walker = walk.walk(__dirname, options);
walker.on('file', function (root, fileStats, next) {
try {
if (!fileStats.name.endsWith('js') && !fileStats.name.endsWith('ts')) {
console.log(`INFO [IAST Secagent] Skipping file ${fileStats.name}`)
} else {
acorn.parse(fs.readFileSync(path.join(root, fileStats.name)), {ecmaVersion: 8})
}
next()
} catch (error) {
console.log(`Parsing error in file ${fileStats.name}`)
console.log(error)
process.exit()
}
}
)
require('./Iast.js')