UNPKG

@hclsoftware/secagent

Version:

IAST agent

35 lines (28 loc) 1.15 kB
//IASTIGNORE /* This file is intended for adding validator for each object that contains a read only property * which we need to hook. */ /* * **************************************************** * Licensed Materials - Property of HCL. * (c) Copyright HCL Technologies Ltd. 2017, 2025. * Note to U.S. Government Users *Restricted Rights. * **************************************************** */ const validators = Object.freeze({ CRYPTO_CREATE_CIPHER: cryptoCreateCipher, SQLITE3_DATABASE_EXEC: sqlite3DataBaseExec }) /* Best effort to check if we in the correct context: * we check if some properties which are expected to be in this object, actually exist. */ function cryptoCreateCipher (that) { return ['createCipher', 'createCipheriv', 'createDecipher', 'Decipher', 'createDecipheriv', 'createDiffieHellman'] .every(p => Object.prototype.hasOwnProperty.call(that, p)) } function sqlite3DataBaseExec (that) { const thatPrototype = Object.getPrototypeOf(that) return ['each', 'exec', 'prepare', 'run'] .every(p => Object.prototype.hasOwnProperty.call(thatPrototype, p)) } module.exports.validators = validators