UNPKG

@hclsoftware/secagent

Version:

IAST agent

39 lines (33 loc) 1.04 kB
//IASTIGNORE /* * **************************************************** * Licensed Materials - Property of HCL. * (c) Copyright HCL Technologies Ltd. 2017, 2025. * 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}: Incompatible with ecmaVersion 8`) console.log(error) process.exit() } } ) require('./Iast.js')