Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lumigo/node-core

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lumigo/node-core - npm Package Compare versions

Comparing version 1.14.1 to 1.14.2

1

lib/common/secrets.d.ts

@@ -14,2 +14,3 @@ export declare enum ScrubContext {

export declare const CIRCULAR_REFERENCE_SYMBOL: unique symbol;
export declare const isCircularReferenceSymbol: (x: any) => x is Symbol;
export declare type SkipPath = (string | SkipPath)[];

@@ -16,0 +17,0 @@ interface ScrubResult<T> {

375

lib/common/secrets.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.scrubWithApproximateMaxPayloadSize = exports.scrub = exports.CIRCULAR_REFERENCE_SYMBOL = exports.getTruncatedValue = exports.isTruncationSymbol = exports.TRUNCATED_SYMBOL = exports.ScrubContext = void 0;
exports.scrubWithApproximateMaxPayloadSize = exports.scrub = exports.isCircularReferenceSymbol = exports.CIRCULAR_REFERENCE_SYMBOL = exports.getTruncatedValue = exports.isTruncationSymbol = exports.TRUNCATED_SYMBOL = exports.ScrubContext = void 0;
const logger_1 = require("../logger");

@@ -20,3 +20,2 @@ const utils_1 = require("../utils");

const SCRUBBING_SYMBOL = Symbol.for('lumigo_scrub');
const APPROXIMATE_SIZE_SYMBOL = Symbol.for('lumigo_scrub_apprx_size');
const TRUNCATED_SYMBOL_PREFIX = 'lumigo_truncated';

@@ -42,6 +41,17 @@ exports.TRUNCATED_SYMBOL = Symbol.for(TRUNCATED_SYMBOL_PREFIX);

exports.CIRCULAR_REFERENCE_SYMBOL = Symbol.for('lumigo_circular_reference');
const isCircularReferenceSymbol = (x) => x === exports.CIRCULAR_REFERENCE_SYMBOL;
exports.isCircularReferenceSymbol = isCircularReferenceSymbol;
const matchesRegexps = (key, regexes) => {
return !!regexes.some((regex) => regex.test(key));
};
const isImmuneFromScrubbing = (value) => typeof value === 'undefined' || value === null || Number.isNaN(value) || (0, utils_2.isBlankString)(value);
/*
* Whether a value should never be scrubbed, even if its key matches a scrub regexp.
* These are exceptions we made because values like these are never leaking information,
* but are known to be involved in bugs, so we should display them to the end users.
*/
const isImmuneFromScrubbing = (value) => typeof value === 'undefined' ||
value === null ||
Number.isNaN(value) ||
(0, utils_2.isBlankString)(value) ||
(0, utils_1.isFunction)(value);
const ALLOW_LIST_REGEXPS = (0, utils_2.safeExecute)(() => (0, utils_2.parseJsonFromEnvVar)(utils_2.LUMIGO_WHITELIST_KEYS_REGEXES, true, []).map((regExp) => new RegExp(regExp, 'i')), 'Cannot parse secret-scrubbing allow-list regexps', logger_1.LOG_LEVELS.WARNING, [])();

@@ -98,15 +108,2 @@ const parseExpressions = (overrideEnvVarName) => {

});
const getApproximateKeyValuePairSizeAsJSON = (key, value, isParentArray, approximateValueSizeAsJSON) => {
let approximatePayloadSizeAsJSON = approximateValueSizeAsJSON !== undefined
? approximateValueSizeAsJSON
: (0, utils_2.getValueLengthAsJSON)(value);
if (!isParentArray) {
/*
* Key length, double-quotes around key and the colon
* between key and value.
*/
approximatePayloadSizeAsJSON += key.length + 3;
}
return approximatePayloadSizeAsJSON;
};
class EnvironmentVariableBasedSecretScrubber {

@@ -143,68 +140,16 @@ constructor(overrideEnvVarName) {

return (0, utils_2.safeExecute)(() => {
const seenFrozenReferences = new Map();
const isPayloadFrozen = Object.isFrozen(payload);
const touchedObjects = new Array();
/*
* Ensure the payload is marked as being scrubbed, this ensure we detect
* circular references early.
*/
if (isPayloadFrozen) {
seenFrozenReferences.set(payload, { ref: SCRUBBING_IN_PROCESS_SYMBOL });
}
else {
payload[SCRUBBING_SYMBOL] = SCRUBBING_IN_PROCESS_SYMBOL;
touchedObjects.push(payload);
}
const { scrubbedPayload, hasScrubbed, hasTruncated, circularReferences, touchedObjects: nestedTouchedObjects, } = this.doScrubObject(payload, seenFrozenReferences, skipScrubPath, maxScrubbedPayloadAsJSONCharacterCount);
if (nestedTouchedObjects === null || nestedTouchedObjects === void 0 ? void 0 : nestedTouchedObjects.length) {
touchedObjects.push(...nestedTouchedObjects);
}
/*
* There is at least one modification that has to be applied somewhere, let's
* clean after ourselves.
*/
circularReferences === null || circularReferences === void 0 ? void 0 : circularReferences.forEach(({ targetObject, targetKey }) => {
if (!Object.isFrozen(targetObject)) {
targetObject[targetKey] = exports.CIRCULAR_REFERENCE_SYMBOL;
/*
* We are no using the valueToReplace, so we need to clean up the markers
* on the original object.
*/
delete targetObject[SCRUBBING_SYMBOL];
delete targetObject[APPROXIMATE_SIZE_SYMBOL];
}
});
/*
* Restore the freeziness of objects as it was in the original
* payload.
*/
for (const { ref } of seenFrozenReferences.values()) {
const seenReferences = new Map([
/*
* Frozen replacements in circular dependencies are
* likely to have our symbols, we must scrub them before
* freezing.
* Ensure the payload is marked as being scrubbed, this ensure we detect
* circular references early.
*/
delete ref[SCRUBBING_SYMBOL];
delete ref[APPROXIMATE_SIZE_SYMBOL];
Object.freeze(ref);
}
touchedObjects === null || touchedObjects === void 0 ? void 0 : touchedObjects.forEach((o) => {
delete o[SCRUBBING_SYMBOL];
delete o[APPROXIMATE_SIZE_SYMBOL];
});
return {
scrubbedPayload,
hasScrubbed,
hasTruncated,
};
[payload, { ref: SCRUBBING_IN_PROCESS_SYMBOL }],
]);
const res = this.doScrubObject(payload, seenReferences, skipScrubPath, maxScrubbedPayloadAsJSONCharacterCount);
return res;
}, 'Cannot scrub payload', logger_1.LOG_LEVELS.WARNING, defaultScrubResult(payload))();
}
doScrubObject(payload,
/*
* For frozen objects we cannot keep references by adding a property
* to them, so we have to keep the reference outside in a less efficient map.
*/
seenFrozenReferences, skipScrubPath = [], approximateScrubbedPayloadSizeAsJSONBudget) {
var _a, _b;
if (approximateScrubbedPayloadSizeAsJSONBudget < 1) {
doScrubObject(payload, seenReferences, skipScrubPath = [], approximateMaxPayloadLength) {
var _a;
if (approximateMaxPayloadLength < 1) {
/*

@@ -214,3 +159,3 @@ * No way we can do anything here

return {
approximatePayloadSize: 0,
approximatePayloadLength: 0,
hasScrubbed: false,

@@ -221,74 +166,60 @@ hasTruncated: true,

}
let touchedObjects = null;
function queueTouchedObjects(...refs) {
if (!touchedObjects) {
touchedObjects = [...refs];
let hasScrubbed = false;
let hasTruncated = false;
let approximatePayloadLength = 2; // Either square or curly brackets
const isPayloadArray = Array.isArray(payload);
const scrubbedPayload = isPayloadArray ? [] : {};
function setKeyValueOnPayload(key, value) {
if (isPayloadArray) {
scrubbedPayload.push(value);
}
else {
touchedObjects.push(...refs);
scrubbedPayload[key] = value;
}
}
/*
* We initialize these lazily. We should avoid allocate empty arrays
* on hot code paths.
*/
let circularReferences = null;
function queueCircularReferences(...refs) {
if (!circularReferences) {
circularReferences = [...refs];
function processKeyValue(key, value, canPartiallyTruncateValue, approximateValueLength = NaN) {
var _a;
let isValueTruncated = (0, exports.isTruncationSymbol)(value);
let valueToSet = value;
const keyAndAccessoriesLength = isPayloadArray
? 0 // Arrays do not represent keys at all
: 2 + // Double quotes around key
key.length +
1; // Colon after key
let approximateKeyValuePairLength = keyAndAccessoriesLength;
if ((0, exports.isCircularReferenceSymbol)(value)) {
approximateKeyValuePairLength += 3; // Double quotes and the circular reference character
}
else if ((0, exports.isTruncationSymbol)(value)) {
approximateKeyValuePairLength +=
2 + // Double quotes around truncation symbol
((_a = (0, exports.getTruncatedValue)(value)) === null || _a === void 0 ? void 0 : _a.length); // Length of the non-truncated part of the value we keep
}
else {
circularReferences.push(...refs);
// Try to estimate the value size
approximateKeyValuePairLength += Number.isFinite(approximateValueLength)
? approximateValueLength
: (0, utils_2.getValueLengthAsJSON)(value);
}
}
let hasScrubbed = false;
let hasTruncated = false;
let approximatePayloadSizeAsJSON = 2; // Either square or curly brackets
/*
* Lazy-initialized array containing keys and values we need to change, e.g.,
*
* [key1, value1, key2, value2, ...]
*/
let modifiedKeysToNewValues;
function queueModifiedKey(key, value, approximateValueSize, canTruncate = true) {
if (!modifiedKeysToNewValues) {
modifiedKeysToNewValues = {};
}
if (!canTruncate || (0, exports.isTruncationSymbol)(value)) {
approximatePayloadSizeAsJSON = approximateScrubbedPayloadSizeAsJSONBudget;
modifiedKeysToNewValues[key] = value;
hasTruncated = true;
}
else {
const approximateKeyValuePairSizeAsJSON = getApproximateKeyValuePairSizeAsJSON(key, value, isPayloadArray, approximateValueSize);
if (canTruncate &&
approximatePayloadSizeAsJSON + approximateKeyValuePairSizeAsJSON >
approximateScrubbedPayloadSizeAsJSONBudget) {
const valueSizeAsJSON = (0, utils_2.getValueLengthAsJSON)(value);
const keyAndAccessoriesLength = approximateKeyValuePairSizeAsJSON - valueSizeAsJSON;
modifiedKeysToNewValues[key] = (0, utils_1.isString)(value)
? createTruncatedSymbol(value, approximateScrubbedPayloadSizeAsJSONBudget -
approximatePayloadSizeAsJSON -
keyAndAccessoriesLength)
if (approximatePayloadLength + approximateKeyValuePairLength > approximateMaxPayloadLength) {
// We need to truncate the value
if (canPartiallyTruncateValue) {
valueToSet = canPartiallyTruncateValue
? createTruncatedSymbol(value, approximateMaxPayloadLength - keyAndAccessoriesLength)
: exports.TRUNCATED_SYMBOL;
approximatePayloadSizeAsJSON = approximateScrubbedPayloadSizeAsJSONBudget;
hasTruncated = true;
}
else {
hasScrubbed = true;
modifiedKeysToNewValues[key] = value;
approximatePayloadSizeAsJSON += approximateKeyValuePairSizeAsJSON;
}
isValueTruncated = true;
}
}
function truncateKeyValueIfNecessary(key, value) {
const approximateKeyValuePairSizeAsJSON = getApproximateKeyValuePairSizeAsJSON(key, value, isPayloadArray);
if (!(0, utils_2.isSymbol)(value) &&
approximatePayloadSizeAsJSON + approximateKeyValuePairSizeAsJSON >
approximateScrubbedPayloadSizeAsJSONBudget) {
queueModifiedKey(key, value);
if (isValueTruncated) {
hasTruncated = true;
/*
* We want to make sure that, once we truncate, we never again can emit
* non-truncated or partially-truncated data.
*/
approximatePayloadLength = approximateMaxPayloadLength;
}
else {
approximatePayloadSizeAsJSON += approximateKeyValuePairSizeAsJSON;
approximatePayloadLength += approximateKeyValuePairLength;
}
setKeyValueOnPayload(key, valueToSet);
}

@@ -322,3 +253,2 @@ /*

let lastProcessedKey;
const isPayloadArray = Array.isArray(payload);
/*

@@ -335,3 +265,3 @@ * The iteration order must be repeatable, so that we can construct the

*/
const lastProcessedValue = modifiedKeysToNewValues === null || modifiedKeysToNewValues === void 0 ? void 0 : modifiedKeysToNewValues[lastProcessedKey];
const lastProcessedValue = scrubbedPayload[lastProcessedKey];
if (lastProcessedValue != exports.CIRCULAR_REFERENCE_SYMBOL &&

@@ -342,4 +272,7 @@ !(0, exports.isTruncationSymbol)(lastProcessedValue)) {

* key: add a truncation marker as the next item.
*
* The truncation reference symbol costs 3 characters, including
* two double-quotes when stringified.
*/
queueModifiedKey(key, exports.TRUNCATED_SYMBOL, 0, false);
processKeyValue(key, exports.TRUNCATED_SYMBOL, false, 3);
lastProcessedKey = key;

@@ -354,12 +287,15 @@ }

*/
approximatePayloadSizeAsJSON += 1;
approximatePayloadLength += 1;
}
lastProcessedKey = key;
const value = payload[key];
const valueLengthAsJSON = (0, utils_2.getValueLengthAsJSON)(value);
if (isImmuneFromScrubbing(value)) {
/*
* No scrubbing needed on this key
* No scrubbing nor truncation needed on this key, it must
* be visible to the end user or kept for stringification.
*
* Keep the functions, they may be needed to serialize to JSON like
* toJSON or toString.
*/
truncateKeyValueIfNecessary(key, value);
processKeyValue(key, value, false, 0);
continue;

@@ -372,6 +308,6 @@ }

*
* We do not increase the approximatePayloadSizeAsJSON, the
* reference we set will be replaced.
* The circular reference symbol costs 3 characters, including
* two double-quotes when stringified.
*/
queueModifiedKey(key, exports.CIRCULAR_REFERENCE_SYMBOL);
processKeyValue(key, exports.CIRCULAR_REFERENCE_SYMBOL, false, 3);
continue;

@@ -382,3 +318,3 @@ }

if (Array.isArray(skipScrubPath[0])) {
isKeyOnSkipPath = Array.isArray(payload);
isKeyOnSkipPath = isPayloadArray;
}

@@ -389,23 +325,13 @@ else {

}
const shouldScrubKey = !isKeyOnSkipPath &&
const shouldScrubKey = !isPayloadArray && // We can only scrub keys of objects
!isKeyOnSkipPath &&
!matchesRegexps(key, ALLOW_LIST_REGEXPS) &&
matchesRegexps(key, this.expressions);
if (shouldScrubKey) {
queueModifiedKey(key, SCRUBBED_TEXT);
processKeyValue(key, SCRUBBED_TEXT, false, SCRUBBED_TEXT.length + 2);
hasScrubbed = true;
continue;
}
if (approximateScrubbedPayloadSizeAsJSONBudget <
approximatePayloadSizeAsJSON + valueLengthAsJSON) {
/*
* We ran out of juice, time to wrap up. To ensure we do not export
* in the scrubbedPayload data we have not scrubbed due to truncation,
* we mark this key as one to have undefined value or the truncation mark,
* depending on the settings.
*/
truncateKeyValueIfNecessary(key, value);
break;
}
if ((0, utils_2.isPrimitiveType)(value)) {
truncateKeyValueIfNecessary(key, value);
processKeyValue(key, value, (0, utils_1.isString)(value));
continue;

@@ -416,6 +342,3 @@ }

*/
const isValueFrozen = Object.isFrozen(value);
const seenReference = isValueFrozen
? (_a = seenFrozenReferences.get(value)) === null || _a === void 0 ? void 0 : _a.ref
: value[SCRUBBING_SYMBOL];
const seenReference = (_a = seenReferences.get(value)) === null || _a === void 0 ? void 0 : _a.ref;
if (seenReference === SCRUBBING_IN_PROCESS_SYMBOL) {

@@ -426,14 +349,3 @@ /*

*/
const circularReference = {
targetObject: payload,
targetKey: key,
valueToReplace: value,
};
queueCircularReferences(circularReference);
/*
* For simplicity, we are counting the circular reference as
* an unnmodified key using the Symbol for the sake of payload
* size estimation.
*/
truncateKeyValueIfNecessary(key, exports.CIRCULAR_REFERENCE_SYMBOL);
processKeyValue(key, exports.CIRCULAR_REFERENCE_SYMBOL, false, 3);
continue;

@@ -447,5 +359,3 @@ }

*/
queueModifiedKey(key, seenReference, isValueFrozen
? seenFrozenReferences.get(value).approximateSize
: parseInt(value[APPROXIMATE_SIZE_SYMBOL]));
processKeyValue(key, seenReference, false, seenReferences.get(value).approximateSize);
continue;

@@ -458,9 +368,3 @@ }

*/
if (isValueFrozen) {
seenFrozenReferences.set(value, { ref: SCRUBBING_IN_PROCESS_SYMBOL });
}
else {
value[SCRUBBING_SYMBOL] = SCRUBBING_IN_PROCESS_SYMBOL;
queueTouchedObjects(value);
}
seenReferences.set(value, { ref: SCRUBBING_IN_PROCESS_SYMBOL });
let nextLevelScrubPath = [];

@@ -475,92 +379,17 @@ try {

}
const { scrubbedPayload: scrubbedValue, hasScrubbed: wasValueScrubbed, hasTruncated: wasValueTruncated, circularReferences: nextLevelCircularReferences, touchedObjects: nextLevelTouchedObjects, approximatePayloadSize: nextLevelApproximatePayloadSize, } = this.doScrubObject(value, seenFrozenReferences, nextLevelScrubPath, approximateScrubbedPayloadSizeAsJSONBudget - approximatePayloadSizeAsJSON);
if (value !== scrubbedValue) {
queueModifiedKey(key, scrubbedValue, nextLevelApproximatePayloadSize, !wasValueTruncated);
}
const { scrubbedPayload: scrubbedValue, hasScrubbed: wasValueScrubbed, hasTruncated: wasValueTruncated, approximatePayloadLength: approximateValueLength, } = this.doScrubObject(value, seenReferences, nextLevelScrubPath, approximateMaxPayloadLength - approximatePayloadLength);
processKeyValue(key, scrubbedValue, false, approximateValueLength);
hasScrubbed || (hasScrubbed = wasValueScrubbed);
hasTruncated || (hasTruncated = wasValueTruncated);
if (isValueFrozen) {
seenFrozenReferences.set(value, {
ref: scrubbedValue,
approximateSize: nextLevelApproximatePayloadSize,
});
}
else {
value[SCRUBBING_SYMBOL] = scrubbedValue;
value[APPROXIMATE_SIZE_SYMBOL] = nextLevelApproximatePayloadSize;
}
if (nextLevelTouchedObjects === null || nextLevelTouchedObjects === void 0 ? void 0 : nextLevelTouchedObjects.length) {
queueTouchedObjects(...nextLevelTouchedObjects);
}
if (nextLevelCircularReferences === null || nextLevelCircularReferences === void 0 ? void 0 : nextLevelCircularReferences.length) {
queueCircularReferences(...nextLevelCircularReferences);
}
approximatePayloadSizeAsJSON += nextLevelApproximatePayloadSize;
seenReferences.set(value, {
ref: scrubbedValue,
approximateSize: approximateValueLength,
});
approximatePayloadLength += approximateValueLength;
}
const isPayloadFrozen = Object.isFrozen(payload);
const seenPayloadReference = isPayloadFrozen
? (_b = seenFrozenReferences.get(payload)) === null || _b === void 0 ? void 0 : _b.ref
: payload[SCRUBBING_SYMBOL];
const isPayloadACircularReference = seenPayloadReference === SCRUBBING_IN_PROCESS_SYMBOL;
const createNewScrubbedPayload = !!modifiedKeysToNewValues || // There are modified values
hasTruncated ||
/*
* Objects with circular references need to be replaced,
* otherwise we cannot ensure that scrubbed versions are
* being returned. However, if the payload is itself a
* circular reference, if we replace it we will 'unroll'
* one level of the circular dependency because of the
* scrubbed-payload substitution.
*/
(!!(circularReferences === null || circularReferences === void 0 ? void 0 : circularReferences.length) && !isPayloadACircularReference) ||
/*
* Errors are special: to ensure we can payloadStringify them,
* we need to return a new object.
*/
(0, utils_2.isError)(payload);
let returnedPayload = payload;
if (createNewScrubbedPayload) {
returnedPayload = (isPayloadArray ? [] : {});
if (isPayloadArray) {
const res = new Array();
for (let i = 0, l = payload.length; i < l; ++i) {
res[i] = (modifiedKeysToNewValues === null || modifiedKeysToNewValues === void 0 ? void 0 : modifiedKeysToNewValues[i]) || payload[i];
if (i.toString() == lastProcessedKey) {
/*
* Truncation occurred after this key was set, or we were anyhow at the end
* of the keys
*/
break;
}
}
returnedPayload = res;
}
else {
returnedPayload = {};
for (const key in objectToIterateOn) {
returnedPayload[key] = (modifiedKeysToNewValues === null || modifiedKeysToNewValues === void 0 ? void 0 : modifiedKeysToNewValues[key]) || payload[key];
if (key == lastProcessedKey) {
/*
* Truncation occurred after this key was set, or we were anyhow at the end
* of the keys.
*/
break;
}
}
}
}
return {
/*
* If we did not modify the payload, just return it.
* This helps reducing overhead with circular references.
*
* Errors are treaded specially by JSON.stringify, so we need
* to return our copy even if we did not scrub.
*/
scrubbedPayload: returnedPayload,
scrubbedPayload: scrubbedPayload,
hasScrubbed,
hasTruncated,
approximatePayloadSize: approximatePayloadSizeAsJSON,
circularReferences,
touchedObjects,
approximatePayloadLength,
};

@@ -567,0 +396,0 @@ }

@@ -14,5 +14,6 @@ export declare const LUMIGO_SECRET_MASKING_REGEX_BACKWARD_COMP = "LUMIGO_BLACKLIST_REGEX";

export declare const isPrimitiveType: (obj: any) => boolean;
export declare const getValueLengthAsJSON: (obj: any, isParentArray?: boolean) => any;
export declare const getValueLengthAsJSON: (obj: any, isParentArray?: boolean) => number;
export declare const isError: (x: any) => x is Error;
export declare const isBlankString: (x: any) => x is string;
export declare const isFunction: (x: any) => x is Function;
export declare const isNonNullObject: (x: any) => x is Object;

@@ -19,0 +20,0 @@ export declare const isString: (x: any) => x is string;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.safeExecute = exports.parseJsonFromEnvVar = exports.getEventEntitySize = exports.isWarm = exports.setWarm = exports.setDebug = exports.isDebug = exports.setStoreLogsOn = exports.isStoreLogs = exports.isSymbol = exports.isString = exports.isNonNullObject = exports.isBlankString = exports.isError = exports.getValueLengthAsJSON = exports.isPrimitiveType = exports.DEFAULT_LUMIGO_MAX_ENTRY_SIZE = exports.OMITTING_KEYS_REGEXES = exports.LUMIGO_WHITELIST_KEYS_REGEXES = exports.LUMIGO_SECRET_MASKING_ALL_MAGIC = exports.LUMIGO_SECRET_MASKING_REGEX_ENVIRONMENT = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_QUERY_PARAMS = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_RESPONSE_HEADERS = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_RESPONSE_BODIES = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_REQUEST_HEADERS = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_REQUEST_BODIES = exports.LUMIGO_SECRET_MASKING_REGEX = exports.LUMIGO_SECRET_MASKING_REGEX_BACKWARD_COMP = void 0;
exports.safeExecute = exports.parseJsonFromEnvVar = exports.getEventEntitySize = exports.isWarm = exports.setWarm = exports.setDebug = exports.isDebug = exports.setStoreLogsOn = exports.isStoreLogs = exports.isSymbol = exports.isString = exports.isNonNullObject = exports.isFunction = exports.isBlankString = exports.isError = exports.getValueLengthAsJSON = exports.isPrimitiveType = exports.DEFAULT_LUMIGO_MAX_ENTRY_SIZE = exports.OMITTING_KEYS_REGEXES = exports.LUMIGO_WHITELIST_KEYS_REGEXES = exports.LUMIGO_SECRET_MASKING_ALL_MAGIC = exports.LUMIGO_SECRET_MASKING_REGEX_ENVIRONMENT = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_QUERY_PARAMS = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_RESPONSE_HEADERS = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_RESPONSE_BODIES = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_REQUEST_HEADERS = exports.LUMIGO_SECRET_MASKING_REGEX_HTTP_REQUEST_BODIES = exports.LUMIGO_SECRET_MASKING_REGEX = exports.LUMIGO_SECRET_MASKING_REGEX_BACKWARD_COMP = void 0;
const logger_1 = require("./logger");

@@ -43,6 +43,8 @@ const DEBUG_FLAG = 'LUMIGO_DEBUG';

switch (typeof obj) {
case 'boolean':
return obj ? 4 : 5; // `true` or `false` in JSON are serialized without surrounding quotes
case 'string':
return obj.length + 2;
case 'object': {
return (obj.toJSON ? obj.toJSON() : String(obj)).length;
return JSON.stringify(obj).length;
}

@@ -66,2 +68,4 @@ case 'undefined': // undefined is not serialized to 'null' as JSON if in array, and skipped if in object

exports.isBlankString = isBlankString;
const isFunction = (x) => typeof x === 'function';
exports.isFunction = isFunction;
const isNonNullObject = (x) => typeof x === 'object' && x !== null;

@@ -68,0 +72,0 @@ exports.isNonNullObject = isNonNullObject;

{
"name": "@lumigo/node-core",
"version": "1.14.1",
"version": "1.14.2",
"description": "Lumigo core node sdk",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc