@contrast/common 1.34.0 → 1.34.2
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/lib/constants.d.ts +16 -0
- package/lib/constants.js +22 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -2
- package/package.json +1 -1
package/lib/constants.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare enum Event {
|
|
2
2
|
RESPONSE_FINISH = "response-finish",
|
|
3
|
+
SERVER_LISTENING = "server-listening",
|
|
3
4
|
ROUTE_COVERAGE_DISCOVERY_FINISHED = "route-coverage-discovery-finished",
|
|
4
5
|
ARCHITECTURE_COMPONENT = "architecture-component",
|
|
5
6
|
ASSESS_DATAFLOW_FINDING = "assess-dataflow-findings",
|
|
@@ -188,6 +189,11 @@ export declare enum DataflowTag {
|
|
|
188
189
|
COOKIE = "COOKIE",
|
|
189
190
|
WEAK_URL_ENCODED = "WEAK_URL_ENCODED"
|
|
190
191
|
}
|
|
192
|
+
export declare enum ServerEnvironment {
|
|
193
|
+
QA = "QA",
|
|
194
|
+
PRODUCTION = "PRODUCTION",
|
|
195
|
+
DEVELOPMENT = "DEVELOPMENT"
|
|
196
|
+
}
|
|
191
197
|
export declare const BLOCKING_MODES: readonly ["block", "block_at_perimeter"];
|
|
192
198
|
export declare const FS_METHODS: readonly [{
|
|
193
199
|
readonly name: "access";
|
|
@@ -382,4 +388,14 @@ export declare enum agentLibIDListTypes {
|
|
|
382
388
|
export declare const symbols: {
|
|
383
389
|
readonly kMetrics: symbol;
|
|
384
390
|
};
|
|
391
|
+
export declare const URI_REGEXES: readonly [{
|
|
392
|
+
readonly rx: RegExp;
|
|
393
|
+
readonly rp: "{uuid}";
|
|
394
|
+
}, {
|
|
395
|
+
readonly rx: RegExp;
|
|
396
|
+
readonly rp: "{hash}";
|
|
397
|
+
}, {
|
|
398
|
+
readonly rx: RegExp;
|
|
399
|
+
readonly rp: "{n}";
|
|
400
|
+
}];
|
|
385
401
|
//# sourceMappingURL=constants.d.ts.map
|
package/lib/constants.js
CHANGED
|
@@ -14,11 +14,12 @@
|
|
|
14
14
|
* way not consistent with the End User License Agreement.
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.symbols = exports.agentLibIDListTypes = exports.FS_METHODS = exports.BLOCKING_MODES = exports.DataflowTag = exports.ExclusionType = exports.InputType = exports.SessionConfigurationRule = exports.ResponseScanningRule = exports.Rule = exports.ProtectRuleMode = exports.Event = void 0;
|
|
17
|
+
exports.URI_REGEXES = exports.symbols = exports.agentLibIDListTypes = exports.FS_METHODS = exports.BLOCKING_MODES = exports.ServerEnvironment = exports.DataflowTag = exports.ExclusionType = exports.InputType = exports.SessionConfigurationRule = exports.ResponseScanningRule = exports.Rule = exports.ProtectRuleMode = exports.Event = void 0;
|
|
18
18
|
var Event;
|
|
19
19
|
(function (Event) {
|
|
20
20
|
// lifecycle
|
|
21
21
|
Event["RESPONSE_FINISH"] = "response-finish";
|
|
22
|
+
Event["SERVER_LISTENING"] = "server-listening";
|
|
22
23
|
Event["ROUTE_COVERAGE_DISCOVERY_FINISHED"] = "route-coverage-discovery-finished";
|
|
23
24
|
// reports
|
|
24
25
|
Event["ARCHITECTURE_COMPONENT"] = "architecture-component";
|
|
@@ -219,6 +220,12 @@ var DataflowTag;
|
|
|
219
220
|
DataflowTag["COOKIE"] = "COOKIE";
|
|
220
221
|
DataflowTag["WEAK_URL_ENCODED"] = "WEAK_URL_ENCODED";
|
|
221
222
|
})(DataflowTag || (exports.DataflowTag = DataflowTag = {}));
|
|
223
|
+
var ServerEnvironment;
|
|
224
|
+
(function (ServerEnvironment) {
|
|
225
|
+
ServerEnvironment["QA"] = "QA";
|
|
226
|
+
ServerEnvironment["PRODUCTION"] = "PRODUCTION";
|
|
227
|
+
ServerEnvironment["DEVELOPMENT"] = "DEVELOPMENT";
|
|
228
|
+
})(ServerEnvironment || (exports.ServerEnvironment = ServerEnvironment = {}));
|
|
222
229
|
exports.BLOCKING_MODES = ['block', 'block_at_perimeter'];
|
|
223
230
|
exports.FS_METHODS = [
|
|
224
231
|
{ name: 'access', promises: true, sync: true, indices: [0] },
|
|
@@ -267,4 +274,18 @@ var agentLibIDListTypes;
|
|
|
267
274
|
exports.symbols = {
|
|
268
275
|
kMetrics: Symbol('contrast.metrics'),
|
|
269
276
|
};
|
|
277
|
+
exports.URI_REGEXES = [
|
|
278
|
+
{
|
|
279
|
+
rx: /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/g,
|
|
280
|
+
rp: '{uuid}'
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
rx: /([a-fA-F0-9]{2}){16,}/g,
|
|
284
|
+
rp: '{hash}'
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
rx: /(\d+)/g,
|
|
288
|
+
rp: '{n}'
|
|
289
|
+
},
|
|
290
|
+
];
|
|
270
291
|
//# sourceMappingURL=constants.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -37,4 +37,5 @@ export declare function set(obj: Record<string, any>, name: string, value: any):
|
|
|
37
37
|
export declare function safeConsoleError(...args: Parameters<typeof console.error>): void;
|
|
38
38
|
/** Suppresses output to stderr when installed by the universal agent */
|
|
39
39
|
export declare function safeConsoleWarn(...args: Parameters<typeof console.warn>): void;
|
|
40
|
+
export declare function normalizeURI(uri: string): string;
|
|
40
41
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -28,14 +28,14 @@ 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.safeConsoleWarn = exports.safeConsoleError = exports.set = exports.get = exports.groupResultsMap = exports.callChildComponentMethods = exports.callChildComponentMethodsSync = exports.traverseKeys = exports.traverseValues = exports.traverseKeysAndValues = exports.encodeString = exports.isNonEmptyObject = exports.isString = exports.empties = void 0;
|
|
31
|
+
exports.normalizeURI = exports.safeConsoleWarn = exports.safeConsoleError = exports.set = exports.get = exports.groupResultsMap = exports.callChildComponentMethods = exports.callChildComponentMethodsSync = exports.traverseKeys = exports.traverseValues = exports.traverseKeysAndValues = exports.encodeString = exports.isNonEmptyObject = exports.isString = exports.empties = void 0;
|
|
32
32
|
const constants_1 = require("./constants");
|
|
33
33
|
const primordials_1 = require("./primordials");
|
|
34
34
|
__exportStar(require("./constants"), exports);
|
|
35
35
|
__exportStar(require("./types"), exports);
|
|
36
36
|
__exportStar(require("./primordials"), exports);
|
|
37
37
|
const { CONTRAST_INSTALLATION_TOOL = 'NONE' } = process.env;
|
|
38
|
-
const { StringPrototypeSplit, BufferFrom, BufferPrototypeToString } = primordials_1.primordials;
|
|
38
|
+
const { StringPrototypeReplaceAll, StringPrototypeSplit, BufferFrom, BufferPrototypeToString } = primordials_1.primordials;
|
|
39
39
|
exports.empties = {
|
|
40
40
|
OBJECT: Object.freeze({}),
|
|
41
41
|
ARRAY: Object.freeze([]),
|
|
@@ -225,4 +225,14 @@ function safeConsoleWarn(...args) {
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
exports.safeConsoleWarn = safeConsoleWarn;
|
|
228
|
+
function normalizeURI(uri) {
|
|
229
|
+
let normalizedUri = uri;
|
|
230
|
+
constants_1.URI_REGEXES.forEach(({ rx, rp }) => {
|
|
231
|
+
//@ts-ignore
|
|
232
|
+
normalizedUri = StringPrototypeReplaceAll.call(normalizedUri, rx, rp);
|
|
233
|
+
});
|
|
234
|
+
return normalizedUri;
|
|
235
|
+
}
|
|
236
|
+
exports.normalizeURI = normalizeURI;
|
|
237
|
+
;
|
|
228
238
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/common",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.2",
|
|
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)",
|