@hclsoftware/secagent
Version:
IAST agent
63 lines (55 loc) • 2 kB
JavaScript
//IASTIGNORE
/*
* ****************************************************
* Licensed Materials - Property of HCL.
* (c) Copyright HCL Technologies Ltd. 2017, 2025.
* Note to U.S. Government Users *Restricted Rights.
* ****************************************************
*/
const infoObj = {
UNQUOTED: null ,
SINGLE_QUOTE: "'" , // '
DOUBLE_QUOTE: "\"" , // "
UNKNOWN: null ,
PARENTHESES: ")" , // ()
BRACES: "}" , // {}
BRACKETS: "]" , // []
// OsCommanding related contexts
DOUBLE_PARENTHESES: null , // (()) - returns zero (success) if result inside parentheses is non-zero, otherwise, return one
DOUBLE_BRACKETS: null , // [[]] - boolean test
ANGLE_PARENTHESES: null , // <()
DOLLAR_SINGLE_PARENTHESES: ")" , // $() - interpolates the output within the subshell (parentheses) into a string
AT_SINGLE_PARENTHESES: ")" , // @() - interpolates the output within the subshell (parentheses) into a string
DOLLAR_SINGLE_PARENTHESES_DOLLAR: null , // $()$ - interpolate the exit code of the subshell
DOLLAR_DOUBLE_PARENTHESES: null , // $(()) - interpolates the output from a DOUBLE_PARENTHESES (which normally returns a binary result) into a string
BACK_TICK: "`" ,
NO_REFLECTION: null ,
MULTIPLE_REFLECTION: null ,
SINGLE_PARENTHESES_BACK_TICK: "`)" , // (` `)
PERCENT: "%",
PATH: null,
}
class ContextType {
constructor() {
for(const field in infoObj){
this[field] = {
contextTypeName : field,
getCtxCloser : infoObj[field]
}
}
}
}
module.exports = new ContextType()
// class ContextType {
// constructor() {
// for(let field in Infoobj){
// this[field] = function(getcloser,f=field){
// if(getcloser){
// return Infoobj[f]
// }
// return f
// }
// }
// }
// }