@contrast/common 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +12 -0
- package/lib/index.d.ts +2 -15
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -55
- package/lib/index.js.map +1 -1
- package/package.json +5 -2
- package/src/constants.ts +0 -244
- package/src/index.ts +0 -335
- package/src/types.ts +0 -331
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright: 2023 Contrast Security, Inc
|
|
2
|
+
Contact: support@contrastsecurity.com
|
|
3
|
+
License: Commercial
|
|
4
|
+
|
|
5
|
+
NOTICE: This Software and the patented inventions embodied within may only be
|
|
6
|
+
used as part of Contrast Security’s commercial offerings. Even though it is
|
|
7
|
+
made available through public repositories, use of this Software is subject to
|
|
8
|
+
the applicable End User Licensing Agreement found at
|
|
9
|
+
https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
10
|
+
between Contrast Security and the End User. The Software may not be reverse
|
|
11
|
+
engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
12
|
+
way not consistent with the End User License Agreement.
|
package/lib/index.d.ts
CHANGED
|
@@ -22,27 +22,14 @@ export declare function groupResultsMap(resultsMap: Partial<ResultMap>): {
|
|
|
22
22
|
semanticResultsMap: Partial<SemanticAnalysisResultsMap>;
|
|
23
23
|
serverFeaturesResultsMap: Partial<ServerFeaturePreliminaryResultsMap>;
|
|
24
24
|
};
|
|
25
|
+
export declare function get(obj: any, name: string): any;
|
|
25
26
|
export declare function set(obj: Record<string, any>, name: string, value: any): void;
|
|
26
|
-
export declare function mergeRemoteData(config: Record<string, any>, remoteData: Record<string, any>, readers: Record<string, any>, setterFn: (target: Record<string, any>, name: string, value: any) => any, target?: Record<string, any>): Record<string, any>;
|
|
27
|
-
export declare const featureReaders: {
|
|
28
|
-
'agent.logger.level': (remoteData: any) => any;
|
|
29
|
-
'agent.logger.path': (remoteData: any) => any;
|
|
30
|
-
'application.session_id': (remoteData: any) => any;
|
|
31
|
-
'agent.security_logger.syslog.enable': (remoteData: any) => any;
|
|
32
|
-
'agent.security_logger.syslog.ip': (remoteData: any) => any;
|
|
33
|
-
'agent.security_logger.syslog.port': (remoteData: any) => any;
|
|
34
|
-
'agent.security_logger.syslog.facility': (remoteData: any) => any;
|
|
35
|
-
'agent.security_logger.syslog.severity_exploited': (remoteData: any) => any;
|
|
36
|
-
'agent.security_logger.syslog.severity_blocked': (remoteData: any) => any;
|
|
37
|
-
'agent.security_logger.syslog.severity_probed': (remoteData: any) => any;
|
|
38
|
-
};
|
|
39
|
-
export declare const settingsReaders: {};
|
|
40
27
|
export declare function join(arr: Array<any>, ...args: []): string;
|
|
41
28
|
export declare function substring(str: string, ...args: any[]): string;
|
|
42
29
|
export declare function substr(str: string, ...args: any[]): string;
|
|
43
30
|
export declare function toLowerCase(str: string): string;
|
|
44
31
|
export declare function toUpperCase(str: string): string;
|
|
45
|
-
export declare function split(str: string, ...args: []): string[];
|
|
32
|
+
export declare function split(str: string, ...args: any[]): string[];
|
|
46
33
|
export declare function trim(str: string, ...args: []): string;
|
|
47
34
|
export declare function replace(str: string, pattern: any, replacement: any): string;
|
|
48
35
|
export declare function match(str: string, pattern: any): RegExpMatchArray | null;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,SAAS,EAAE,0BAA0B,EAAE,kCAAkC,EAAE,MAAM,SAAS,CAAC;AAEhJ,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AAExB,UAAU,gBAAgB;IACxB,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GA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
|
@@ -28,7 +28,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
28
28
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.stringify = exports.inspect = exports.slice = exports.matchAll = exports.match = exports.replace = exports.trim = exports.split = exports.toUpperCase = exports.toLowerCase = exports.substr = exports.substring = exports.join = exports.
|
|
31
|
+
exports.stringify = exports.inspect = exports.slice = exports.matchAll = exports.match = exports.replace = exports.trim = exports.split = exports.toUpperCase = exports.toLowerCase = exports.substr = exports.substring = exports.join = exports.set = exports.get = exports.groupResultsMap = exports.callChildComponentMethods = exports.callChildComponentMethodsSync = exports.traverseKeys = exports.traverseValues = exports.traverseKeysAndValues = exports.encodeString = exports.isNonEmptyObject = exports.isString = void 0;
|
|
32
32
|
const constants_1 = require("./constants");
|
|
33
33
|
__exportStar(require("./constants"), exports);
|
|
34
34
|
__exportStar(require("./types"), exports);
|
|
@@ -176,8 +176,19 @@ function groupResultsMap(resultsMap) {
|
|
|
176
176
|
return result;
|
|
177
177
|
}
|
|
178
178
|
exports.groupResultsMap = groupResultsMap;
|
|
179
|
+
function get(obj, name) {
|
|
180
|
+
let target = obj;
|
|
181
|
+
const props = split(name, '.');
|
|
182
|
+
for (const prop of props) {
|
|
183
|
+
target = target?.[prop];
|
|
184
|
+
if (target === undefined)
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
return target;
|
|
188
|
+
}
|
|
189
|
+
exports.get = get;
|
|
179
190
|
function set(obj, name, value) {
|
|
180
|
-
const props =
|
|
191
|
+
const props = split(name, '.');
|
|
181
192
|
const lastProp = props.pop();
|
|
182
193
|
for (const p of props) {
|
|
183
194
|
if (!obj[p])
|
|
@@ -187,59 +198,6 @@ function set(obj, name, value) {
|
|
|
187
198
|
obj[lastProp] = value;
|
|
188
199
|
}
|
|
189
200
|
exports.set = set;
|
|
190
|
-
function mergeRemoteData(config, remoteData, readers, setterFn, target) {
|
|
191
|
-
const targetConfig = target || config;
|
|
192
|
-
for (const [name, readerFn] of Object.entries(readers)) {
|
|
193
|
-
const remoteValue = readerFn(remoteData);
|
|
194
|
-
if (['DEFAULT_VALUE', 'CONTRAST_UI'].includes(config._sources[name]) && remoteValue != null) {
|
|
195
|
-
setterFn(targetConfig, name, remoteValue);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return targetConfig;
|
|
199
|
-
}
|
|
200
|
-
exports.mergeRemoteData = mergeRemoteData;
|
|
201
|
-
exports.featureReaders = {
|
|
202
|
-
'agent.logger.level': (remoteData) => remoteData.logger?.level,
|
|
203
|
-
'agent.logger.path': (remoteData) => remoteData.logger?.path,
|
|
204
|
-
'application.session_id': (remoteData) => remoteData?.settings?.assessment?.session_id,
|
|
205
|
-
'agent.security_logger.syslog.enable': (remoteData) => remoteData.security_logger?.syslog?.enable,
|
|
206
|
-
'agent.security_logger.syslog.ip': (remoteData) => remoteData.security_logger?.syslog?.ip,
|
|
207
|
-
'agent.security_logger.syslog.port': (remoteData) => remoteData.security_logger?.syslog?.port,
|
|
208
|
-
'agent.security_logger.syslog.facility': (remoteData) => remoteData.security_logger?.syslog?.facility,
|
|
209
|
-
'agent.security_logger.syslog.severity_exploited': (remoteData) => remoteData.security_logger?.syslog?.severity_exploited,
|
|
210
|
-
'agent.security_logger.syslog.severity_blocked': (remoteData) => remoteData.security_logger?.syslog?.severity_blocked,
|
|
211
|
-
'agent.security_logger.syslog.severity_probed': (remoteData) => remoteData.security_logger?.syslog?.severity_probed,
|
|
212
|
-
};
|
|
213
|
-
exports.settingsReaders = [
|
|
214
|
-
'protect.rules.cmd-injection.mode',
|
|
215
|
-
'protect.rules.cmd-injection-command-backdoors.mode',
|
|
216
|
-
'protect.rules.cmd-injection-semantic-chained-commands.mode',
|
|
217
|
-
'protect.rules.cmd-injection-semantic-dangerous-paths.mode',
|
|
218
|
-
'protect.rules.method-tampering.mode',
|
|
219
|
-
'protect.rules.nosql-injection.mode',
|
|
220
|
-
'protect.rules.nosql-injection-mongo.mode',
|
|
221
|
-
'protect.rules.path-traversal.mode',
|
|
222
|
-
'protect.rules.path-traversal-semantic-file-security-bypass.mode',
|
|
223
|
-
'protect.rules.reflected-xss.mode',
|
|
224
|
-
'protect.rules.sql-injection.mode',
|
|
225
|
-
'protect.rules.ssjs-injection.mode',
|
|
226
|
-
'protect.rules.unsafe-file-upload.mode',
|
|
227
|
-
'protect.rules.untrusted-deserialization.mode',
|
|
228
|
-
'protect.rules.xxe.mode',
|
|
229
|
-
].reduce((acc, name) => {
|
|
230
|
-
const ruleId = name.split('.')[2];
|
|
231
|
-
return Object.assign(acc, {
|
|
232
|
-
[name]: (remoteData) => {
|
|
233
|
-
const remoteSetting = remoteData?.protect?.rules?.[ruleId];
|
|
234
|
-
switch (remoteSetting?.mode) {
|
|
235
|
-
case 'OFF': return constants_1.ProtectRuleMode.OFF;
|
|
236
|
-
case 'MONITORING': return constants_1.ProtectRuleMode.MONITOR;
|
|
237
|
-
case 'BLOCKING': return constants_1.ProtectRuleMode.BLOCK;
|
|
238
|
-
case 'BLOCK_AT_PERIMETER': return constants_1.ProtectRuleMode.BLOCK_AT_PERIMETER;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
}, {});
|
|
243
201
|
const { join: origJoin } = Array.prototype;
|
|
244
202
|
function join(arr, ...args) {
|
|
245
203
|
return origJoin.call(arr, ...args);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;AAEH,2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G,MAAM,CAAC,SAAS,CAAC;AAC9C,SAAgB,KAAK,CAAC,GAAW,EAAE,GAAG,IAAW;IAC/C,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AACtC,CAAC;AAFD,sBAEC;AAED,+BAAkD;AAClD,SAAgB,OAAO,CAAC,GAAG,IAAS;IAClC,6DAA6D;IAC7D,aAAa;IACb,OAAO,cAAe,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAC7C,CAAC;AAJD,0BAIC;AAED,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;AAC1C,SAAgB,SAAS,CAAC,KAAU;IAClC,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAFD,8BAEC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Shared constants and utilities for all Contrast Agent modules",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib/"
|
|
9
|
+
],
|
|
7
10
|
"main": "lib/index.js",
|
|
8
11
|
"types": "lib/index.d.ts",
|
|
9
12
|
"engines": {
|
|
@@ -14,4 +17,4 @@
|
|
|
14
17
|
"build": "tsc --build src/",
|
|
15
18
|
"test": "../scripts/test.sh"
|
|
16
19
|
}
|
|
17
|
-
}
|
|
20
|
+
}
|
package/src/constants.ts
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2023 Contrast Security, Inc
|
|
3
|
-
* Contact: support@contrastsecurity.com
|
|
4
|
-
* License: Commercial
|
|
5
|
-
|
|
6
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
* made available through public repositories, use of this Software is subject to
|
|
9
|
-
* the applicable End User Licensing Agreement found at
|
|
10
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
* way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export enum Event {
|
|
17
|
-
ASSESS = 'assess',
|
|
18
|
-
PROTECT = 'protect',
|
|
19
|
-
LIBRARY_USAGE = 'library-usage',
|
|
20
|
-
LIBRARY = 'library',
|
|
21
|
-
ARCHITECTURE_COMPONENT = 'architecture-component',
|
|
22
|
-
SERVER_SETTINGS_UPDATE = 'server-settings-update',
|
|
23
|
-
ASSESS_DATAFLOW_FINDING = 'assess-dataflow-findings',
|
|
24
|
-
ASSESS_DATAFLOW_SAFE_POSITIVE = 'assess-dataflow-safe-positive',
|
|
25
|
-
ASSESS_RESPONSE_SCANNING_FINDING = 'assess-response-scanning-findings',
|
|
26
|
-
ASSESS_SESSION_CONFIGURATION_FINDING = 'assess-session-configuration-findings',
|
|
27
|
-
RESPONSE_FINISH = 'response-finish',
|
|
28
|
-
ROUTE_COVERAGE_DISCOVERY = 'route-coverage-discovery',
|
|
29
|
-
ROUTE_COVERAGE_DISCOVERY_FINISHED = 'route-coverage-discovery-finished',
|
|
30
|
-
ROUTE_COVERAGE_OBSERVATION = 'route-coverage-observation',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export enum ProtectRuleMode {
|
|
34
|
-
OFF = 'off',
|
|
35
|
-
MONITOR = 'monitor',
|
|
36
|
-
BLOCK = 'block',
|
|
37
|
-
BLOCK_AT_PERIMETER = 'block_at_perimeter',
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export enum Rule {
|
|
41
|
-
BOT_BLOCKER = 'bot-blocker',
|
|
42
|
-
CMD_INJECTION = 'cmd-injection',
|
|
43
|
-
CMD_INJECTION_COMMAND_BACKDOORS = 'cmd-injection-command-backdoors',
|
|
44
|
-
CMD_INJECTION_SEMANTIC_CHAINED_COMMANDS = 'cmd-injection-semantic-chained-commands',
|
|
45
|
-
CMD_INJECTION_SEMANTIC_DANGEROUS_PATHS = 'cmd-injection-semantic-dangerous-paths',
|
|
46
|
-
IP_DENYLIST = 'ip-denylist',
|
|
47
|
-
METHOD_TAMPERING = 'method-tampering',
|
|
48
|
-
NOSQL_INJECTION = 'nosql-injection',
|
|
49
|
-
NOSQL_INJECTION_MONGO = 'nosql-injection-mongo',
|
|
50
|
-
PATH_TRAVERSAL = 'path-traversal',
|
|
51
|
-
PATH_TRAVERSAL_SEMANTIC_FILE_SECURITY_BYPASS = 'path-traversal-semantic-file-security-bypass',
|
|
52
|
-
REFLECTED_XSS = 'reflected-xss',
|
|
53
|
-
SQL_INJECTION = 'sql-injection',
|
|
54
|
-
SSJS_INJECTION = 'ssjs-injection',
|
|
55
|
-
UNSAFE_FILE_UPLOAD = 'unsafe-file-upload',
|
|
56
|
-
UNTRUSTED_DESERIALIZATION = 'untrusted-deserialization',
|
|
57
|
-
VIRTUAL_PATCH = 'virtual-patch',
|
|
58
|
-
XXE = 'xxe',
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export enum ResponseScanningRule {
|
|
62
|
-
AUTOCOMPLETE_MISSING = 'autocomplete-missing',
|
|
63
|
-
CACHE_CONTROLS_MISSING = 'cache-controls-missing',
|
|
64
|
-
CLICKJACKING_CONTROL_MISSING = 'clickjacking-control-missing',
|
|
65
|
-
PARAMETER_POLLUTION = 'parameter-pollution',
|
|
66
|
-
CSP_HEADER_MISSING = 'csp-header-missing',
|
|
67
|
-
CSP_HEADER_INSECURE = 'csp-header-insecure',
|
|
68
|
-
HSTS_HEADER_MISSING = 'hsts-header-missing',
|
|
69
|
-
X_POWERED_BY_HEADER = 'x-powered-by-header',
|
|
70
|
-
XCONTENTTYPE_HEADER_MISSING = 'xcontenttype-header-missing',
|
|
71
|
-
XXSPROTECTION_HEADER_DISABLED = 'xxssprotection-header-disabled'
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export enum SessionConfigurationRule {
|
|
75
|
-
HTTPONLY = 'httponly',
|
|
76
|
-
SECURE_FLAG_MISSING = 'secure-flag-missing'
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export enum InputType {
|
|
80
|
-
UNDEFINED_TYPE = 'UNDEFINED_TYPE',
|
|
81
|
-
BODY = 'BODY',
|
|
82
|
-
COOKIE_NAME = 'COOKIE_NAME',
|
|
83
|
-
COOKIE_VALUE = 'COOKIE_VALUE',
|
|
84
|
-
HEADER = 'HEADER',
|
|
85
|
-
PARAMETER_NAME = 'PARAMETER_NAME',
|
|
86
|
-
PARAMETER_VALUE = 'PARAMETER_VALUE',
|
|
87
|
-
QUERYSTRING = 'QUERYSTRING',
|
|
88
|
-
URI = 'URI',
|
|
89
|
-
SOCKET = 'SOCKET',
|
|
90
|
-
JSON_VALUE = 'JSON_VALUE',
|
|
91
|
-
JSON_ARRAYED_VALUE = 'JSON_ARRAYED_VALUE',
|
|
92
|
-
MULTIPART_CONTENT_TYPE = 'MULTIPART_CONTENT_TYPE',
|
|
93
|
-
MULTIPART_VALUE = 'MULTIPART_VALUE',
|
|
94
|
-
MULTIPART_FIELD_NAME = 'MULTIPART_FIELD_NAME',
|
|
95
|
-
MULTIPART_NAME = 'MULTIPART_NAME',
|
|
96
|
-
XML_VALUE = 'XML_VALUE',
|
|
97
|
-
DWR_VALUE = 'DWR_VALUE',
|
|
98
|
-
METHOD = 'METHOD',
|
|
99
|
-
REQUEST = 'REQUEST',
|
|
100
|
-
URL_PARAMETER = 'URL_PARAMETER',
|
|
101
|
-
UNKNOWN = 'UNKNOWN',
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export enum DataflowTag {
|
|
105
|
-
XML_ENCODED = 'XML_ENCODED',
|
|
106
|
-
XML_DECODED = 'XML_DECODED',
|
|
107
|
-
HTML_ENCODED = 'HTML_ENCODED',
|
|
108
|
-
HTML_DECODED = 'HTML_DECODED',
|
|
109
|
-
URL_ENCODED = 'URL_ENCODED',
|
|
110
|
-
URL_DECODED = 'URL_DECODED',
|
|
111
|
-
CSS_ENCODED = 'CSS_ENCODED',
|
|
112
|
-
CSS_DECODED = 'CSS_DECODED',
|
|
113
|
-
BASE64_ENCODED = 'BASE64_ENCODED',
|
|
114
|
-
BASE64_DECODED = 'BASE64_DECODED',
|
|
115
|
-
JAVASCRIPT_ENCODED = 'JAVASCRIPT_ENCODED',
|
|
116
|
-
JAVASCRIPT_DECODED = 'JAVASCRIPT_DECODED',
|
|
117
|
-
JAVA_ENCODED = 'JAVA_ENCODED',
|
|
118
|
-
JAVA_DECODED = 'JAVA_DECODED',
|
|
119
|
-
CSV_ENCODED = 'CSV_ENCODED',
|
|
120
|
-
CSV_DECODED = 'CSV_DECODED',
|
|
121
|
-
SQL_ENCODED = 'SQL_ENCODED',
|
|
122
|
-
SQL_DECODED = 'SQL_DECODED',
|
|
123
|
-
LDAP_ENCODED = 'LDAP_ENCODED',
|
|
124
|
-
LDAP_DECODED = 'LDAP_DECODED',
|
|
125
|
-
XPATH_ENCODED = 'XPATH_ENCODED',
|
|
126
|
-
XPATH_DECODED = 'XPATH_DECODED',
|
|
127
|
-
OS_ENCODED = 'OS_ENCODED',
|
|
128
|
-
OS_DECODED = 'OS_DECODED',
|
|
129
|
-
VBSCRIPT_ENCODED = 'VBSCRIPT_ENCODED',
|
|
130
|
-
VBSCRIPT_DECODED = 'VBSCRIPT_DECODED',
|
|
131
|
-
POTENTIAL_SANITIZED = 'POTENTIAL_SANITIZED',
|
|
132
|
-
POTENTIAL_VALIDATED = 'POTENTIAL_VALIDATED',
|
|
133
|
-
NO_CONTROL_CHARS = 'NO_CONTROL_CHARS',
|
|
134
|
-
CUSTOM = 'CUSTOM_CATCH_ALL',
|
|
135
|
-
// custom encoded/validated tags, only for data flow rules
|
|
136
|
-
CUSTOM_ENCODED = 'CUSTOM_ENCODED',
|
|
137
|
-
CUSTOM_ENCODED_CMD_INJECTION = 'CUSTOM_ENCODED_CMD_INJECTION',
|
|
138
|
-
CUSTOM_ENCODED_EXPRESSION_LANGUAGE_INJECTION = 'CUSTOM_ENCODED_EXPRESSION_LANGUAGE_INJECTION',
|
|
139
|
-
CUSTOM_ENCODED_HEADER_INJECTION = 'CUSTOM_ENCODED_HEADER_INJECTION',
|
|
140
|
-
CUSTOM_ENCODED_HQL_INJECTION = 'CUSTOM_ENCODED_HQL_INJECTION',
|
|
141
|
-
CUSTOM_ENCODED_LDAP_INJECTION = 'CUSTOM_ENCODED_LDAP_INJECTION',
|
|
142
|
-
CUSTOM_ENCODED_LOG_INJECTION = 'CUSTOM_ENCODED_LOG_INJECTION',
|
|
143
|
-
CUSTOM_ENCODED_NOSQL_INJECTIOn = 'CUSTOM_ENCODED_NOSQL_INJECTION',
|
|
144
|
-
CUSTOM_ENCODED_PATH_TRAVERSAL = 'CUSTOM_ENCODED_PATH_TRAVERSAL',
|
|
145
|
-
CUSTOM_ENCODED_REDOS = 'CUSTOM_ENCODED_REDOS',
|
|
146
|
-
CUSTOM_ENCODED_REFLECTED_XSS = 'CUSTOM_ENCODED_REFLECTED_XSS',
|
|
147
|
-
CUSTOM_ENCODED_REFLECTION_INJECTION = 'CUSTOM_ENCODED_REFLECTION_INJECTION',
|
|
148
|
-
CUSTOM_ENCODED_SMTP_INJECTION = 'CUSTOM_ENCODED_SMTP_INJECTION',
|
|
149
|
-
CUSTOM_ENCODED_SQL_INJECTION = 'CUSTOM_ENCODED_SQL_INJECTION',
|
|
150
|
-
CUSTOM_ENCODED_SSRF = 'CUSTOM_ENCODED_SSRF',
|
|
151
|
-
CUSTOM_ENCODED_STORED_XSS = 'CUSTOM_ENCODED_STORED_XSS',
|
|
152
|
-
CUSTOM_ENCODED_TRUST_BOUNDARY_VIOLATION = 'CUSTOM_ENCODED_TRUST_BOUNDARY_VIOLATION',
|
|
153
|
-
CUSTOM_ENCODED_UNSAFE_CODE_EXECUTION = 'CUSTOM_ENCODED_UNSAFE_CODE_EXECUTION',
|
|
154
|
-
CUSTOM_ENCODED_UNSAFE_READLINE = 'CUSTOM_ENCODED_UNSAFE_READLINE',
|
|
155
|
-
CUSTOM_ENCODED_UNSAFE_XML_DECODE = 'CUSTOM_ENCODED_UNSAFE_XML_DECODE',
|
|
156
|
-
CUSTOM_ENCODED_UNTRUSTED_DESERIALIZATION = 'CUSTOM_ENCODED_UNTRUSTED_DESERIALIZATION',
|
|
157
|
-
CUSTOM_ENCODED_UNVALIDATED_FORWARD = 'CUSTOM_ENCODED_UNVALIDATED_FORWARD',
|
|
158
|
-
CUSTOM_ENCODED_UNVALIDATED_REDIRECT = 'CUSTOM_ENCODED_UNVALIDATED_REDIRECT',
|
|
159
|
-
CUSTOM_ENCODED_XPATH_INJECTION = 'CUSTOM_ENCODED_XPATH_INJECTION',
|
|
160
|
-
CUSTOM_ENCODED_XXE = 'CUSTOM_ENCODED_XXE',
|
|
161
|
-
CUSTOM_SECURITY_CONTROL_APPLIED = 'CUSTOM_SECURITY_CONTROL_APPLIED',
|
|
162
|
-
CUSTOM_VALIDATED = 'CUSTOM_VALIDATED',
|
|
163
|
-
CUSTOM_VALIDATED_CMD_INJECTION = 'CUSTOM_VALIDATED_CMD_INJECTION',
|
|
164
|
-
CUSTOM_VALIDATED_EXPRESSION_LANGUAGE_INJECTION = 'CUSTOM_VALIDATED_EXPRESSION_LANGUAGE_INJECTION',
|
|
165
|
-
CUSTOM_VALIDATED_HEADER_INJECTION = 'CUSTOM_VALIDATED_HEADER_INJECTION',
|
|
166
|
-
CUSTOM_VALIDATED_HQL_INJECTION = 'CUSTOM_VALIDATED_HQL_INJECTION',
|
|
167
|
-
CUSTOM_VALIDATED_LDAP_INJECTION = 'CUSTOM_VALIDATED_LDAP_INJECTION',
|
|
168
|
-
CUSTOM_VALIDATED_LOG_INJECTION = 'CUSTOM_VALIDATED_LOG_INJECTION',
|
|
169
|
-
CUSTOM_VALIDATED_NOSQL_INJECTION = 'CUSTOM_VALIDATED_NOSQL_INJECTION',
|
|
170
|
-
CUSTOM_VALIDATED_PATH_TRAVERSAL = 'CUSTOM_VALIDATED_PATH_TRAVERSAL',
|
|
171
|
-
CUSTOM_VALIDATED_REDOS = 'CUSTOM_VALIDATED_REDOS',
|
|
172
|
-
CUSTOM_VALIDATED_REFLECTED_XSS = 'CUSTOM_VALIDATED_REFLECTED_XSS',
|
|
173
|
-
CUSTOM_VALIDATED_REFLECTION_INJECTION = 'CUSTOM_VALIDATED_REFLECTION_INJECTION',
|
|
174
|
-
CUSTOM_VALIDATED_SMTP_INJECTION = 'CUSTOM_VALIDATED_SMTP_INJECTION',
|
|
175
|
-
CUSTOM_VALIDATED_SQL_INJECTION = 'CUSTOM_VALIDATED_SQL_INJECTION',
|
|
176
|
-
CUSTOM_VALIDATED_SSRF = 'CUSTOM_VALIDATED_SSRF',
|
|
177
|
-
CUSTOM_VALIDATED_STORED_XSS = 'CUSTOM_VALIDATED_STORED_XSS',
|
|
178
|
-
CUSTOM_VALIDATED_TRUST_BOUNDARY_VIOLATION = 'CUSTOM_VALIDATED_TRUST_BOUNDARY_VIOLATION',
|
|
179
|
-
CUSTOM_VALIDATED_UNSAFE_CODE_EXECUTION = 'CUSTOM_VALIDATED_UNSAFE_CODE_EXECUTION',
|
|
180
|
-
CUSTOM_VALIDATED_UNSAFE_READLINE = 'CUSTOM_VALIDATED_UNSAFE_READLINE',
|
|
181
|
-
CUSTOM_VALIDATED_UNSAFE_XML_DECODE = 'CUSTOM_VALIDATED_UNSAFE_XML_DECODE',
|
|
182
|
-
CUSTOM_VALIDATED_UNTRUSTED_DESERIALIZATION = 'CUSTOM_VALIDATED_UNTRUSTED_DESERIALIZATION',
|
|
183
|
-
CUSTOM_VALIDATED_UNVALIDATED_FORWARD = 'CUSTOM_VALIDATED_UNVALIDATED_FORWARD',
|
|
184
|
-
CUSTOM_VALIDATED_UNVALIDATED_REDIRECT = 'CUSTOM_VALIDATED_UNVALIDATED_REDIRECT',
|
|
185
|
-
CUSTOM_VALIDATED_XPATH_INJECTION = 'CUSTOM_VALIDATED_XPATH_INJECTION',
|
|
186
|
-
CUSTOM_VALIDATED_XXE = 'CUSTOM_VALIDATED_XXE',
|
|
187
|
-
// tracked_string range tags
|
|
188
|
-
NO_NEWLINES = 'NO_NEWLINES',
|
|
189
|
-
UNTRUSTED = 'UNTRUSTED',
|
|
190
|
-
CROSS_SITE = 'CROSS_SITE',
|
|
191
|
-
LIMITED_CHARS = 'LIMITED_CHARS',
|
|
192
|
-
ALPHANUM_SPACE_HYPHEN = 'ALPHANUM_SPACE_HYPHEN',
|
|
193
|
-
STRING_TYPE_CHECKED = 'STRING_TYPE_CHECKED',
|
|
194
|
-
DATABASE_WRITE = 'DATABASE_WRITE',
|
|
195
|
-
HEADER = 'HEADER',
|
|
196
|
-
COOKIE = 'COOKIE',
|
|
197
|
-
WEAK_URL_ENCODED = 'WEAK_URL_ENCODED',
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export const BLOCKING_MODES = ['block', 'block_at_perimeter'];
|
|
201
|
-
|
|
202
|
-
export const FS_METHODS = [
|
|
203
|
-
{ name: 'access', promises: true, sync: true, indices: [0] },
|
|
204
|
-
{ name: 'appendFile', promises: true, sync: true, indices: [0] },
|
|
205
|
-
{ name: 'chmod', promises: true, sync: true, indices: [0] },
|
|
206
|
-
{ name: 'chown', promises: true, sync: true, indices: [0] },
|
|
207
|
-
{ name: 'copyFile', promises: true, sync: true, indices: [0, 1] },
|
|
208
|
-
{ name: 'cp', promises: true, sync: true, indices: [0, 1] },
|
|
209
|
-
{ name: 'createReadStream', promises: false, sync: false, indices: [0] },
|
|
210
|
-
{ name: 'createWriteStream', promises: false, sync: false, indices: [0] },
|
|
211
|
-
{ name: 'exists', promises: false, sync: true, indices: [0] },
|
|
212
|
-
{ name: 'lchmod', promises: true, sync: true, indices: [0] },
|
|
213
|
-
{ name: 'lchown', promises: true, sync: true, indices: [0] },
|
|
214
|
-
{ name: 'link', promises: true, sync: true, indices: [0] },
|
|
215
|
-
{ name: 'lstat', promises: true, sync: true, indices: [0] },
|
|
216
|
-
{ name: 'lutimes', promises: true, sync: true, indices: [0] },
|
|
217
|
-
{ name: 'mkdir', promises: true, sync: true, indices: [0] },
|
|
218
|
-
{ name: 'mkdtemp', promises: true, sync: true, indices: [0] },
|
|
219
|
-
{ name: 'open', promises: true, sync: true, indices: [0] },
|
|
220
|
-
{ name: 'openAsBlob', promises: false, sync: false, indices: [0] },
|
|
221
|
-
{ name: 'opendir', promises: true, sync: true, indices: [0] },
|
|
222
|
-
{ name: 'readdir', promises: true, sync: true, indices: [0] },
|
|
223
|
-
{ name: 'readFile', promises: true, sync: true, indices: [0] },
|
|
224
|
-
{ name: 'readlink', promises: true, sync: true, indices: [0] },
|
|
225
|
-
{ name: 'realpath', promises: true, sync: true, indices: [0] },
|
|
226
|
-
{ name: 'rename', promises: true, sync: true, indices: [0, 1] },
|
|
227
|
-
{ name: 'rmdir', promises: true, sync: true, indices: [0] },
|
|
228
|
-
{ name: 'rm', promises: true, sync: true, indices: [0] },
|
|
229
|
-
{ name: 'stat', promises: true, sync: true, indices: [0] },
|
|
230
|
-
{ name: 'statfs', promises: true, sync: true, indices: [0] },
|
|
231
|
-
{ name: 'symlink', promises: true, sync: true, indices: [0, 1] },
|
|
232
|
-
{ name: 'truncate', promises: true, sync: true, indices: [0] },
|
|
233
|
-
{ name: 'unlink', promises: true, sync: true, indices: [0] },
|
|
234
|
-
{ name: 'unwatchFile', promises: false, sync: false, indices: [0] },
|
|
235
|
-
{ name: 'utimes', promises: true, sync: true, indices: [0] },
|
|
236
|
-
{ name: 'watch', promises: true, sync: false, indices: [0] },
|
|
237
|
-
{ name: 'watchFile', promises: false, sync: false, indices: [0] },
|
|
238
|
-
{ name: 'writeFile', promises: true, sync: true, indices: [0] },
|
|
239
|
-
] as const;
|
|
240
|
-
|
|
241
|
-
export enum agentLibIDListTypes {
|
|
242
|
-
MONGO_SLEEP = 'MONGO-SLEEP',
|
|
243
|
-
TRUE_CLAUSE_1 = 'TRUE-CLAUSE-1'
|
|
244
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2023 Contrast Security, Inc
|
|
3
|
-
* Contact: support@contrastsecurity.com
|
|
4
|
-
* License: Commercial
|
|
5
|
-
|
|
6
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
* made available through public repositories, use of this Software is subject to
|
|
9
|
-
* the applicable End User Licensing Agreement found at
|
|
10
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
* way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { Rule, ProtectRuleMode } from './constants';
|
|
17
|
-
import { CommonRulesResultsMap, HardeningResultsMap, ResultMap, SemanticAnalysisResultsMap, ServerFeaturePreliminaryResultsMap } from './types';
|
|
18
|
-
|
|
19
|
-
export * from './constants';
|
|
20
|
-
export * from './types';
|
|
21
|
-
|
|
22
|
-
interface TraverseCallback {
|
|
23
|
-
(path: any[], type: 'Key' | 'Value', value: any, obj: any): unknown;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Returns true if the value passed is either a primitive string or a
|
|
28
|
-
* String object.
|
|
29
|
-
*/
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
31
|
-
export function isString(value: unknown): value is string | String {
|
|
32
|
-
return typeof value === 'string' || value instanceof String;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function isNonEmptyObject(value: unknown): value is object {
|
|
36
|
-
return !!value && typeof value === 'object' && Object.keys(value).length > 0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* c8 ignore next 3 */
|
|
40
|
-
export function encodeString(str: string): string {
|
|
41
|
-
return Buffer.from(str).toString('base64');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function traverse(
|
|
45
|
-
obj: any,
|
|
46
|
-
cb: TraverseCallback,
|
|
47
|
-
path: any[],
|
|
48
|
-
traverseValues: boolean,
|
|
49
|
-
traverseKeys: boolean,
|
|
50
|
-
depth = Infinity
|
|
51
|
-
) {
|
|
52
|
-
let shouldKeepTraversing = true;
|
|
53
|
-
let reachedDepth = 0;
|
|
54
|
-
|
|
55
|
-
function _traverse(
|
|
56
|
-
obj: any,
|
|
57
|
-
cb: TraverseCallback,
|
|
58
|
-
path: any[],
|
|
59
|
-
traverseValues: boolean,
|
|
60
|
-
traverseKeys: boolean,
|
|
61
|
-
) {
|
|
62
|
-
const isArray = Array.isArray(obj);
|
|
63
|
-
|
|
64
|
-
for (const k in obj) {
|
|
65
|
-
if (!shouldKeepTraversing || reachedDepth >= depth) return;
|
|
66
|
-
|
|
67
|
-
if (isArray) {
|
|
68
|
-
const _k = Number(k);
|
|
69
|
-
// if it is an array, store each index in path but don't call the
|
|
70
|
-
// callback on the index itself as they are just numeric strings.
|
|
71
|
-
path.push(_k);
|
|
72
|
-
if (typeof obj[_k] === 'object' && obj[_k] !== null) {
|
|
73
|
-
reachedDepth++;
|
|
74
|
-
_traverse(obj[_k], cb, path, traverseValues, traverseKeys);
|
|
75
|
-
} else if (typeof obj[_k] === 'string' && obj[_k]) {
|
|
76
|
-
if (traverseValues && cb(path, 'Value', obj[_k], obj)) {
|
|
77
|
-
return shouldKeepTraversing = false;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
path.pop();
|
|
81
|
-
} else if (typeof obj[k] === 'object' && obj[k] !== null) {
|
|
82
|
-
if (traverseKeys && cb(path, 'Key', k, obj)) {
|
|
83
|
-
return shouldKeepTraversing = false;
|
|
84
|
-
}
|
|
85
|
-
path.push(k);
|
|
86
|
-
reachedDepth++;
|
|
87
|
-
_traverse(obj[k], cb, path, traverseValues, traverseKeys);
|
|
88
|
-
path.pop();
|
|
89
|
-
} else {
|
|
90
|
-
if (traverseKeys && cb(path, 'Key', k, obj)) {
|
|
91
|
-
return shouldKeepTraversing = false;
|
|
92
|
-
}
|
|
93
|
-
// only callback if the value is a non-empty string
|
|
94
|
-
if (typeof obj[k] === 'string' && obj[k]) {
|
|
95
|
-
path.push(k);
|
|
96
|
-
if (traverseValues && cb(path, 'Value', obj[k], obj)) {
|
|
97
|
-
return shouldKeepTraversing = false;
|
|
98
|
-
}
|
|
99
|
-
path.pop();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
_traverse(obj, cb, path, traverseValues, traverseKeys);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function traverseKeysAndValues(obj: any, cb: TraverseCallback, depth?: number) {
|
|
109
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
traverse(obj, cb, [], true, true, depth);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function traverseValues(obj: any, cb: TraverseCallback, depth?: number) {
|
|
116
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
traverse(obj, cb, [], true, false, depth);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export function traverseKeys(obj: any, cb: TraverseCallback, depth?: number) {
|
|
123
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
traverse(obj, cb, [], false, true, depth);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function callChildComponentMethodsSync(parent: any, method: 'install' | 'uninstall', order?: string[]) {
|
|
130
|
-
const keys = order || Object.keys(parent);
|
|
131
|
-
for (const key of keys) {
|
|
132
|
-
const component: any = parent[key];
|
|
133
|
-
component?.[method]?.();
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
export async function callChildComponentMethods(parent: any, method: 'install' | 'uninstall', order?: string[]) {
|
|
138
|
-
const keys = order || Object.keys(parent);
|
|
139
|
-
for (const key of keys) {
|
|
140
|
-
const component: any = parent[key];
|
|
141
|
-
await component?.[method]?.();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export function groupResultsMap(resultsMap: Partial<ResultMap>) {
|
|
146
|
-
const result: {
|
|
147
|
-
commonResultsMap: Partial<CommonRulesResultsMap>;
|
|
148
|
-
hardeningResultsMap: Partial<HardeningResultsMap>;
|
|
149
|
-
semanticResultsMap: Partial<SemanticAnalysisResultsMap>;
|
|
150
|
-
serverFeaturesResultsMap: Partial<ServerFeaturePreliminaryResultsMap>;
|
|
151
|
-
} = {
|
|
152
|
-
commonResultsMap: {},
|
|
153
|
-
hardeningResultsMap: {},
|
|
154
|
-
semanticResultsMap: {},
|
|
155
|
-
serverFeaturesResultsMap: {},
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
Object.keys(resultsMap).reduce((acc, rule) => {
|
|
159
|
-
switch (rule) {
|
|
160
|
-
case Rule.SQL_INJECTION:
|
|
161
|
-
case Rule.CMD_INJECTION:
|
|
162
|
-
case Rule.PATH_TRAVERSAL:
|
|
163
|
-
case Rule.REFLECTED_XSS:
|
|
164
|
-
case Rule.SSJS_INJECTION:
|
|
165
|
-
case Rule.NOSQL_INJECTION_MONGO:
|
|
166
|
-
case Rule.UNSAFE_FILE_UPLOAD:
|
|
167
|
-
case Rule.BOT_BLOCKER:
|
|
168
|
-
case Rule.NOSQL_INJECTION:
|
|
169
|
-
acc.commonResultsMap[rule] = resultsMap[rule];
|
|
170
|
-
break;
|
|
171
|
-
case Rule.CMD_INJECTION_SEMANTIC_DANGEROUS_PATHS:
|
|
172
|
-
case Rule.CMD_INJECTION_SEMANTIC_CHAINED_COMMANDS:
|
|
173
|
-
case Rule.XXE:
|
|
174
|
-
case Rule.CMD_INJECTION_COMMAND_BACKDOORS:
|
|
175
|
-
case Rule.PATH_TRAVERSAL_SEMANTIC_FILE_SECURITY_BYPASS:
|
|
176
|
-
acc.semanticResultsMap[rule] = resultsMap[rule];
|
|
177
|
-
break;
|
|
178
|
-
case Rule.VIRTUAL_PATCH:
|
|
179
|
-
case Rule.IP_DENYLIST:
|
|
180
|
-
acc.serverFeaturesResultsMap[rule] = resultsMap[rule];
|
|
181
|
-
break;
|
|
182
|
-
case Rule.UNTRUSTED_DESERIALIZATION:
|
|
183
|
-
acc.hardeningResultsMap[rule] = resultsMap[rule];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return acc;
|
|
187
|
-
}, result);
|
|
188
|
-
|
|
189
|
-
return result;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export function set(obj: Record<string, any>, name: string, value: any) {
|
|
193
|
-
const props = name.split('.');
|
|
194
|
-
const lastProp = props.pop() as string;
|
|
195
|
-
for (const p of props) {
|
|
196
|
-
if (!obj[p]) obj[p] = {};
|
|
197
|
-
obj = obj[p];
|
|
198
|
-
}
|
|
199
|
-
obj[lastProp] = value;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export function mergeRemoteData(
|
|
203
|
-
config: Record<string, any>,
|
|
204
|
-
remoteData: Record<string, any>,
|
|
205
|
-
readers: Record<string, any>,
|
|
206
|
-
setterFn: (target: Record<string, any>, name: string, value: any) => any,
|
|
207
|
-
target?: Record<string, any>
|
|
208
|
-
) {
|
|
209
|
-
const targetConfig = target || config;
|
|
210
|
-
for (const [name, readerFn] of Object.entries(readers)) {
|
|
211
|
-
const remoteValue = readerFn(remoteData);
|
|
212
|
-
if (['DEFAULT_VALUE', 'CONTRAST_UI'].includes(config._sources[name]) && remoteValue != null) {
|
|
213
|
-
setterFn(targetConfig, name, remoteValue);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return targetConfig;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export const featureReaders = {
|
|
221
|
-
'agent.logger.level': (remoteData: any) => remoteData.logger?.level,
|
|
222
|
-
'agent.logger.path': (remoteData: any) => remoteData.logger?.path,
|
|
223
|
-
'application.session_id': (remoteData: any) => remoteData?.settings?.assessment?.session_id,
|
|
224
|
-
'agent.security_logger.syslog.enable': (remoteData: any) => remoteData.security_logger?.syslog?.enable,
|
|
225
|
-
'agent.security_logger.syslog.ip': (remoteData: any) => remoteData.security_logger?.syslog?.ip,
|
|
226
|
-
'agent.security_logger.syslog.port': (remoteData: any) => remoteData.security_logger?.syslog?.port,
|
|
227
|
-
'agent.security_logger.syslog.facility': (remoteData: any) => remoteData.security_logger?.syslog?.facility,
|
|
228
|
-
'agent.security_logger.syslog.severity_exploited': (remoteData: any) => remoteData.security_logger?.syslog?.severity_exploited,
|
|
229
|
-
'agent.security_logger.syslog.severity_blocked': (remoteData: any) => remoteData.security_logger?.syslog?.severity_blocked,
|
|
230
|
-
'agent.security_logger.syslog.severity_probed': (remoteData: any) => remoteData.security_logger?.syslog?.severity_probed,
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export const settingsReaders = [
|
|
234
|
-
'protect.rules.cmd-injection.mode',
|
|
235
|
-
'protect.rules.cmd-injection-command-backdoors.mode',
|
|
236
|
-
'protect.rules.cmd-injection-semantic-chained-commands.mode',
|
|
237
|
-
'protect.rules.cmd-injection-semantic-dangerous-paths.mode',
|
|
238
|
-
'protect.rules.method-tampering.mode',
|
|
239
|
-
'protect.rules.nosql-injection.mode',
|
|
240
|
-
'protect.rules.nosql-injection-mongo.mode',
|
|
241
|
-
'protect.rules.path-traversal.mode',
|
|
242
|
-
'protect.rules.path-traversal-semantic-file-security-bypass.mode',
|
|
243
|
-
'protect.rules.reflected-xss.mode',
|
|
244
|
-
'protect.rules.sql-injection.mode',
|
|
245
|
-
'protect.rules.ssjs-injection.mode',
|
|
246
|
-
'protect.rules.unsafe-file-upload.mode',
|
|
247
|
-
'protect.rules.untrusted-deserialization.mode',
|
|
248
|
-
'protect.rules.xxe.mode',
|
|
249
|
-
].reduce((acc, name) => {
|
|
250
|
-
const ruleId = name.split('.')[2];
|
|
251
|
-
return Object.assign(acc, {
|
|
252
|
-
[name]: (remoteData: any) => {
|
|
253
|
-
const remoteSetting = remoteData?.protect?.rules?.[ruleId];
|
|
254
|
-
switch (remoteSetting?.mode) {
|
|
255
|
-
case 'OFF': return ProtectRuleMode.OFF;
|
|
256
|
-
case 'MONITORING': return ProtectRuleMode.MONITOR;
|
|
257
|
-
case 'BLOCKING': return ProtectRuleMode.BLOCK;
|
|
258
|
-
case 'BLOCK_AT_PERIMETER': return ProtectRuleMode.BLOCK_AT_PERIMETER;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}, {});
|
|
263
|
-
|
|
264
|
-
const { join: origJoin } = Array.prototype;
|
|
265
|
-
export function join(arr: Array<any>, ...args: []) {
|
|
266
|
-
return origJoin.call(arr, ...args);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const { substring: origSubstring } = String.prototype;
|
|
270
|
-
export function substring(str: string, ...args: any[]) {
|
|
271
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
272
|
-
// @ts-ignore
|
|
273
|
-
return origSubstring.call(str, ...args);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
const { substr: origSubstr } = String.prototype;
|
|
277
|
-
export function substr(str: string, ...args: any[]) {
|
|
278
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
279
|
-
// @ts-ignore
|
|
280
|
-
return origSubstr.call(str, ...args);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
const { toLowerCase: origToLowerCase } = String.prototype;
|
|
284
|
-
export function toLowerCase(str: string) {
|
|
285
|
-
return origToLowerCase.call(str);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
const { toUpperCase: origToUpperCase } = String.prototype;
|
|
289
|
-
export function toUpperCase(str: string) {
|
|
290
|
-
return origToUpperCase.call(str);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
const { split: origSplit } = String.prototype;
|
|
294
|
-
export function split(str: string, ...args: []) {
|
|
295
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
296
|
-
// @ts-ignore
|
|
297
|
-
return origSplit.call(str, ...args);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
const { trim: origTrim } = String.prototype;
|
|
301
|
-
export function trim(str: string, ...args: []) {
|
|
302
|
-
return origTrim.call(str, ...args);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const { replace: origReplace } = String.prototype;
|
|
306
|
-
export function replace(str: string, pattern: any, replacement: any) {
|
|
307
|
-
return origReplace.call(str, pattern, replacement);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
const { match: origMatch } = String.prototype;
|
|
311
|
-
export function match(str: string, pattern: any) {
|
|
312
|
-
return origMatch.call(str, pattern);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const { matchAll: origMatchAll } = String.prototype;
|
|
316
|
-
export function matchAll(str: string, pattern: any) {
|
|
317
|
-
return origMatchAll.call(str, pattern);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const { slice: origSlice } = String.prototype;
|
|
321
|
-
export function slice(str: string, ...args: any[]) {
|
|
322
|
-
return origSlice.call(str, ...args);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
import { inspect as originalInspect } from 'util';
|
|
326
|
-
export function inspect(...args: any) {
|
|
327
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
328
|
-
// @ts-ignore
|
|
329
|
-
return originalInspect.call(null, ...args);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
const { stringify: origStringify } = JSON;
|
|
333
|
-
export function stringify(value: any) {
|
|
334
|
-
return origStringify(value);
|
|
335
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2023 Contrast Security, Inc
|
|
3
|
-
* Contact: support@contrastsecurity.com
|
|
4
|
-
* License: Commercial
|
|
5
|
-
|
|
6
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
* made available through public repositories, use of this Software is subject to
|
|
9
|
-
* the applicable End User Licensing Agreement found at
|
|
10
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
* way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { EventEmitter } from 'events';
|
|
17
|
-
import { Event, ProtectRuleMode, Rule } from './constants';
|
|
18
|
-
|
|
19
|
-
export interface Installable {
|
|
20
|
-
install(): void | Promise<void>;
|
|
21
|
-
uninstall?(): void | Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface Signature {
|
|
25
|
-
moduleName: string;
|
|
26
|
-
methodName: string;
|
|
27
|
-
fileName?: string;
|
|
28
|
-
version?: string;
|
|
29
|
-
isModule: boolean;
|
|
30
|
-
isConstructor?: boolean;
|
|
31
|
-
source?: 'O' | 'P' | 'R';
|
|
32
|
-
target?: 'O' | 'P' | 'R';
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface AppInfo {
|
|
36
|
-
os: {
|
|
37
|
-
type: string;
|
|
38
|
-
platform: string;
|
|
39
|
-
architecture: string;
|
|
40
|
-
release: string;
|
|
41
|
-
};
|
|
42
|
-
hostname: string;
|
|
43
|
-
name: string;
|
|
44
|
-
pkg: object; // package.json
|
|
45
|
-
agentVersion: string;
|
|
46
|
-
app_dir: string;
|
|
47
|
-
serverVersion: string;
|
|
48
|
-
node_version: string;
|
|
49
|
-
appPath: string;
|
|
50
|
-
indexFile: string;
|
|
51
|
-
serverName: string;
|
|
52
|
-
serverEnvironment: string;
|
|
53
|
-
version: string;
|
|
54
|
-
session_id: string | null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type CommonRules =
|
|
58
|
-
Rule.SQL_INJECTION |
|
|
59
|
-
Rule.CMD_INJECTION |
|
|
60
|
-
Rule.PATH_TRAVERSAL |
|
|
61
|
-
Rule.REFLECTED_XSS |
|
|
62
|
-
Rule.SSJS_INJECTION |
|
|
63
|
-
Rule.NOSQL_INJECTION_MONGO |
|
|
64
|
-
Rule.UNSAFE_FILE_UPLOAD |
|
|
65
|
-
Rule.NOSQL_INJECTION |
|
|
66
|
-
Rule.METHOD_TAMPERING |
|
|
67
|
-
Rule.BOT_BLOCKER;
|
|
68
|
-
|
|
69
|
-
export type SemanticAnalysisRules =
|
|
70
|
-
Rule.CMD_INJECTION_SEMANTIC_DANGEROUS_PATHS |
|
|
71
|
-
Rule.CMD_INJECTION_SEMANTIC_CHAINED_COMMANDS |
|
|
72
|
-
Rule.XXE |
|
|
73
|
-
Rule.CMD_INJECTION_COMMAND_BACKDOORS |
|
|
74
|
-
Rule.PATH_TRAVERSAL_SEMANTIC_FILE_SECURITY_BYPASS;
|
|
75
|
-
|
|
76
|
-
export type ServerFeaturePreliminaryRules = Rule.VIRTUAL_PATCH | Rule.IP_DENYLIST;
|
|
77
|
-
|
|
78
|
-
export type HardeningRules = Rule.UNTRUSTED_DESERIALIZATION;
|
|
79
|
-
|
|
80
|
-
export interface Result {
|
|
81
|
-
blocked: boolean;
|
|
82
|
-
exploitMetadata?: any[] | any; // TODO
|
|
83
|
-
idsList?: string[];
|
|
84
|
-
inputType: string; // TODO
|
|
85
|
-
key?: string;
|
|
86
|
-
mappedId: string;
|
|
87
|
-
mongoExpansionResult?: boolean;
|
|
88
|
-
path?: string[];
|
|
89
|
-
ruleId: Rule;
|
|
90
|
-
score: number;
|
|
91
|
-
value: string;
|
|
92
|
-
sinkContext?: any;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface SemanticAnalysisResult extends Result {
|
|
96
|
-
ruleId: SemanticAnalysisRules;
|
|
97
|
-
exploitMetadata: {
|
|
98
|
-
command?: string;
|
|
99
|
-
prolog?: string;
|
|
100
|
-
xml?: string;
|
|
101
|
-
}[];
|
|
102
|
-
sinkContext?: any;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface HardeningResult extends Result {
|
|
106
|
-
exploitMetadata: {
|
|
107
|
-
command?: boolean;
|
|
108
|
-
deserializer?: string;
|
|
109
|
-
}[];
|
|
110
|
-
sinkContext?: any;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface ServerFeaturePreliminaryResult {
|
|
114
|
-
name?: string;
|
|
115
|
-
uuid: string;
|
|
116
|
-
ip?: string;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface ServerFeatureResult extends Result {
|
|
120
|
-
exploitMetadata?: ServerFeaturePreliminaryResult[];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface ReqData {
|
|
124
|
-
method: string;
|
|
125
|
-
headers: string[];
|
|
126
|
-
uriPath: string;
|
|
127
|
-
queries: string;
|
|
128
|
-
contentType?: string;
|
|
129
|
-
ip: string;
|
|
130
|
-
httpVersion: string;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export type CommonRulesResultsMap = {
|
|
134
|
-
[rule in CommonRules]: Result[];
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export type SemanticAnalysisResultsMap = {
|
|
138
|
-
[rule in SemanticAnalysisRules]: SemanticAnalysisResult[];
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export type ServerFeaturePreliminaryResultsMap = {
|
|
142
|
-
[rule in ServerFeaturePreliminaryRules]: ServerFeaturePreliminaryResult[]
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export type HardeningResultsMap = {
|
|
146
|
-
[rule in HardeningRules]: HardeningResult[];
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export type ResultMap = CommonRulesResultsMap & SemanticAnalysisResultsMap & ServerFeaturePreliminaryResultsMap & HardeningResultsMap;
|
|
150
|
-
|
|
151
|
-
export interface ProtectMessage {
|
|
152
|
-
reqData: ReqData;
|
|
153
|
-
block: (mode: string, ruleId: string) => void;
|
|
154
|
-
policy: Partial<Record<Rule, ProtectRuleMode>>;
|
|
155
|
-
exclusions: any[]; // TODO
|
|
156
|
-
virtualPatches: any[]; // TODO
|
|
157
|
-
trackRequest: boolean;
|
|
158
|
-
securityException?: [mode: ProtectRuleMode, ruleId: string];
|
|
159
|
-
bodyType?: 'json' | 'urlencoded';
|
|
160
|
-
resultsMap: Partial<ResultMap>
|
|
161
|
-
parsedBody: any;
|
|
162
|
-
parsedCookies: any;
|
|
163
|
-
parsedParams: any;
|
|
164
|
-
parsedQuery: any;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface SourceInfo {
|
|
168
|
-
serverType: string;
|
|
169
|
-
port: number;
|
|
170
|
-
protocol: string;
|
|
171
|
-
time: number;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* this is known as RequestStore even though, in the future, instrumentation
|
|
176
|
-
* will exist for message buses or sources other than HTTP requests. "request"
|
|
177
|
-
* seems generic enough that it's not hard to understand that request can mean
|
|
178
|
-
* an amqp message or other request to perform work that might get user input.
|
|
179
|
-
* additionally, at this time, the only things instrumented are HTTP requests,
|
|
180
|
-
* and other things are only possible extensions to the core facility. it seems
|
|
181
|
-
* reasonable that they will fit into the primary concept that the agent deals
|
|
182
|
-
* with, requests, whether from HTTP or elsewhere.
|
|
183
|
-
*/
|
|
184
|
-
export interface RequestStore {
|
|
185
|
-
// TODO: this shouldn't be optional but blows up
|
|
186
|
-
sourceInfo?: SourceInfo;
|
|
187
|
-
protect?: ProtectMessage; // from protect/lib/make-source-context
|
|
188
|
-
assess?: any;
|
|
189
|
-
route?: any;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Architecture Component registration event payload.
|
|
194
|
-
*/
|
|
195
|
-
export interface ArchitectureComponent {
|
|
196
|
-
/** The type of this component: database, ldap, or web server connection. */
|
|
197
|
-
type: 'db' | 'ldap' | 'ws',
|
|
198
|
-
/**
|
|
199
|
-
* The URL to which this component responds.
|
|
200
|
-
* @example "mysql://host:3306"
|
|
201
|
-
*/
|
|
202
|
-
url: string;
|
|
203
|
-
/**
|
|
204
|
-
* Some indication of the subtype of the connection.
|
|
205
|
-
* @example "MySQL"
|
|
206
|
-
*/
|
|
207
|
-
vendor?: string;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Library discovery event payload.
|
|
212
|
-
*/
|
|
213
|
-
export interface Library {
|
|
214
|
-
/**
|
|
215
|
-
* The time, in ms, that the library was last modified on the filesystem.
|
|
216
|
-
* Must be greater than 0 and less than 32503679999000 (Tuesday, 31 December 2999 23:59:59).
|
|
217
|
-
* @todo
|
|
218
|
-
*/
|
|
219
|
-
externalDate: number;
|
|
220
|
-
/**
|
|
221
|
-
* The time, in ms, that the library was last modified on the filesystem.
|
|
222
|
-
* Must be greater than 0 and less than 32503679999000 (Tuesday, 31 December 2999 23:59:59).
|
|
223
|
-
* @todo
|
|
224
|
-
*/
|
|
225
|
-
internalDate: number;
|
|
226
|
-
/**
|
|
227
|
-
* The version of the library.
|
|
228
|
-
* @example "2.18.1"
|
|
229
|
-
*/
|
|
230
|
-
version: string;
|
|
231
|
-
/**
|
|
232
|
-
* Hash of the library. uses the provided SHA sum when present, or a generated
|
|
233
|
-
* identifer otherwise.
|
|
234
|
-
* @example "2254143855c5a8c73825e4522baf2ea021766717"
|
|
235
|
-
* @example "mysql:2.18.1"
|
|
236
|
-
*/
|
|
237
|
-
hash: string;
|
|
238
|
-
/**
|
|
239
|
-
* Name of the library with version data
|
|
240
|
-
* @example "mysql-2.18.1"
|
|
241
|
-
*/
|
|
242
|
-
file: string;
|
|
243
|
-
/**
|
|
244
|
-
* Homepage or source of the library.
|
|
245
|
-
* @example "https://github.com/mysqljs/mysql#readme"
|
|
246
|
-
* @example "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz"
|
|
247
|
-
*/
|
|
248
|
-
url?: string;
|
|
249
|
-
/**
|
|
250
|
-
* String describing the library, including name, description, license,
|
|
251
|
-
* dependencies and dependents.
|
|
252
|
-
*/
|
|
253
|
-
manifest: string;
|
|
254
|
-
/**
|
|
255
|
-
* Library tags provided by the user to the agent.
|
|
256
|
-
*/
|
|
257
|
-
tags: string;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Library usage update event payload.
|
|
262
|
-
*/
|
|
263
|
-
export interface LibraryUsage {
|
|
264
|
-
id: string;
|
|
265
|
-
names: string[];
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Route discovery or observation event payload.
|
|
270
|
-
*/
|
|
271
|
-
export interface RouteInfo {
|
|
272
|
-
/**
|
|
273
|
-
* Language specific signature of the controller method.
|
|
274
|
-
* @example "Router.get('prefix/route/path', [Function])"
|
|
275
|
-
*/
|
|
276
|
-
signature: string;
|
|
277
|
-
/**
|
|
278
|
-
* The HTTP method supported by the discovered route url, if one is reported.
|
|
279
|
-
* @example "get"
|
|
280
|
-
*/
|
|
281
|
-
method?: string;
|
|
282
|
-
/**
|
|
283
|
-
* Normalized URL for a route.
|
|
284
|
-
* @example "prefix/route/path"
|
|
285
|
-
*/
|
|
286
|
-
url: string;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Agent event emitter for messaging to/from external systems. Use cases are
|
|
291
|
-
* reporting agent findings and broadcasting settings updates.
|
|
292
|
-
*
|
|
293
|
-
* The final, generic, overloads for emit/on matches any calls that don't match
|
|
294
|
-
* one of the more specific definitions.
|
|
295
|
-
*/
|
|
296
|
-
export interface Messages extends EventEmitter {
|
|
297
|
-
emit(event: Event.ARCHITECTURE_COMPONENT, msg: ArchitectureComponent): boolean;
|
|
298
|
-
emit(event: Event.ASSESS_DATAFLOW_FINDING, msg: any): boolean;
|
|
299
|
-
emit(event: Event.LIBRARY, msg: Library): boolean;
|
|
300
|
-
emit(event: Event.LIBRARY_USAGE, msg: LibraryUsage): boolean;
|
|
301
|
-
emit(event: Event.PROTECT, msg: RequestStore): boolean;
|
|
302
|
-
emit(event: Event.ROUTE_COVERAGE_DISCOVERY, route: RouteInfo): boolean;
|
|
303
|
-
emit(event: Event.ROUTE_COVERAGE_DISCOVERY_FINISHED, routes: RouteInfo[]): boolean;
|
|
304
|
-
emit(event: Event.ROUTE_COVERAGE_OBSERVATION, route: RouteInfo): boolean;
|
|
305
|
-
emit(event: Event.SERVER_SETTINGS_UPDATE, msg: Record<string, any>): boolean;
|
|
306
|
-
emit(event: Event, ...args: any[]): boolean;
|
|
307
|
-
|
|
308
|
-
on(event: Event.ARCHITECTURE_COMPONENT, listener: (msg: ArchitectureComponent) => void): this;
|
|
309
|
-
on(event: Event.ASSESS_DATAFLOW_FINDING, listenter: (msg: any) => void): this;
|
|
310
|
-
on(event: Event.LIBRARY, listener: (msg: Library) => void): this;
|
|
311
|
-
on(event: Event.LIBRARY_USAGE, listener: (msg: LibraryUsage) => void): this;
|
|
312
|
-
on(event: Event.PROTECT, listener: (msg: RequestStore) => void): this;
|
|
313
|
-
on(event: Event.ROUTE_COVERAGE_DISCOVERY, listener: (route: RouteInfo) => void): this;
|
|
314
|
-
on(event: Event.ROUTE_COVERAGE_DISCOVERY_FINISHED, listener: (routes: RouteInfo[]) => void): this;
|
|
315
|
-
on(event: Event.ROUTE_COVERAGE_OBSERVATION, listener: (route: RouteInfo) => void): this;
|
|
316
|
-
on(event: Event.SERVER_SETTINGS_UPDATE, listener: (msg: Record<string, any>) => void): this;
|
|
317
|
-
on(event: Event, listener: (...args: any[]) => void): this;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Agent event emitter for broadcasting internal lifecycle events.
|
|
322
|
-
*
|
|
323
|
-
* The final, generic, overloads for emit/on matches any calls that don't match
|
|
324
|
-
* one of the more specific definitions.
|
|
325
|
-
*/
|
|
326
|
-
export interface Lifecycle extends EventEmitter {
|
|
327
|
-
emit(event: Event, ...args: any[]): boolean;
|
|
328
|
-
|
|
329
|
-
on(event: Event.RESPONSE_FINISH, listener: (msg: RequestStore) => void): this;
|
|
330
|
-
on(event: Event, listener: (...args: any[]) => void): this;
|
|
331
|
-
}
|