@hclsoftware/secagent
Version:
IAST agent
47 lines (38 loc) • 1.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 SessionTracker = require("./SessionTracker");
const EntityType = {
PARAMETER: 'parameter',
PARAMETER_NAME: 'parameterName',
HEADER: 'header',
HEADER_NAME: 'headerName',
COOKIE: 'cookie',
QUERY: 'query',
COMPONENT: 'component',
RESPONSE: 'response',
NO_TYPE: '',
MESSAGE: 'message',
BODY: 'body',
}
class Entity {
constructor(entityName, entityValue, entityType) {
this.type = entityType
this.name = entityName
this.value = entityValue
this.isPassword = SessionTracker.isPasswordName(this.name);
}
// called by JSON.stringify, we use this function to ignore specific properties.
toJSON() {
const excludedKeys = new Set(["isPassword"])
return Object.fromEntries(Object.entries(this).filter(([key]) => !excludedKeys.has(key)))
}
}
module.exports.Entity = Entity
module.exports.EntityType = EntityType