@contrast/assess 1.16.0 → 1.16.1
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.
|
@@ -130,31 +130,28 @@ module.exports = function (core) {
|
|
|
130
130
|
name: 'JSON.prototype.parse',
|
|
131
131
|
patchType,
|
|
132
132
|
pre(data) {
|
|
133
|
-
if (!sources.getStore()?.assess || instrumentation.isLocked()) return;
|
|
134
|
-
const input = data.args
|
|
133
|
+
if (!data.args[0] || !sources.getStore()?.assess || instrumentation.isLocked()) return;
|
|
134
|
+
const [input, reviver] = data.args;
|
|
135
135
|
|
|
136
136
|
const strInfo = tracker.getData(input);
|
|
137
137
|
if (!strInfo) return;
|
|
138
138
|
|
|
139
|
-
const reviver = data.args[1];
|
|
140
139
|
const stack = [];
|
|
141
|
-
let keyValueIndexes;
|
|
140
|
+
let keyValueIndexes = [];
|
|
142
141
|
|
|
143
142
|
try {
|
|
144
143
|
keyValueIndexes = getKeyValueIndexes(input);
|
|
145
144
|
} catch (error) {
|
|
146
145
|
logger.warn({ error, string: input }, 'JSON.parse() propagation failed');
|
|
147
|
-
keyValueIndexes = [];
|
|
148
146
|
}
|
|
149
147
|
|
|
150
|
-
// Error found, continue without instrumentation
|
|
151
148
|
if (keyValueIndexes.length === 0) return;
|
|
152
149
|
|
|
153
150
|
let i = 0;
|
|
154
151
|
function contrastParseReviver(key, value) {
|
|
155
152
|
const { value: [startIndex, endIndex] } = keyValueIndexes[i];
|
|
156
153
|
|
|
157
|
-
if (!isString(value)) {
|
|
154
|
+
if (!value || !isString(value)) {
|
|
158
155
|
return reviver ? reviver(key, value) : value;
|
|
159
156
|
}
|
|
160
157
|
|
|
@@ -173,7 +170,7 @@ module.exports = function (core) {
|
|
|
173
170
|
}
|
|
174
171
|
|
|
175
172
|
data.args[1] = function (key, value) {
|
|
176
|
-
if (typeof value === 'object') {
|
|
173
|
+
if (value && typeof value === 'object') {
|
|
177
174
|
applyValuesToObject(value, stack);
|
|
178
175
|
}
|
|
179
176
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/assess",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.1",
|
|
4
4
|
"description": "Contrast service providing framework-agnostic Assess support",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|