@hclsoftware/secagent
Version:
IAST agent
51 lines (43 loc) • 1.84 kB
JavaScript
//IASTIGNORE
/*
* ****************************************************
* Licensed Materials - Property of HCL.
* (c) Copyright HCL Technologies Ltd. 2017, 2025.
* Note to U.S. Government Users *Restricted Rights.
* ****************************************************
*/
const property = Object.freeze({
TAINTED_DATA: '__iast_tainted_data',
SOURCE_PROXY: '__iast_source_proxy',
FUNCTION_PROXY: '__iast_function_proxy',
PROPAGATE_FIELD: '__iast_propagate_field',
INFO: '__iast_info',
SINK_TASKS: '__iast_sink_tasks'
})
const defaultAttributes = {
// https://javascript.info/property-descriptors#property-flags
writable: true, // if true, the value can be changed, otherwise it’s read-only. (default false)
enumerable: false, // if true, then listed in loops, otherwise not listed. (default false)
configurable: true // if true, the property can be deleted and these attributes can be modified, otherwise not. (default false)
}
function definePropertyWithValue(obj, propName, propValue, attributes = undefined) {
attributes = attributes || defaultAttributes
Object.defineProperty(obj, propName, {
value: propValue,
writable: attributes.writable,
enumerable: attributes.enumerable,
configurable: attributes.configurable
})
}
function definePropertyWithGetterSetter(obj, propName, getter, setter, attributes = undefined) {
attributes = attributes || defaultAttributes
Object.defineProperty(obj, propName, {
get: getter,
set: setter,
enumerable: attributes.enumerable,
configurable: attributes.configurable
})
}
module.exports.property = property
module.exports.definePropertyWithValue = definePropertyWithValue
module.exports.definePropertyWithGetterSetter = definePropertyWithGetterSetter