mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Ensure permission log will only store JSON-able data (#10524)
This commit is contained in:
parent
9339278d3c
commit
a29fc51838
@ -1,4 +1,4 @@
|
||||
import { cloneDeep } from 'lodash';
|
||||
import stringify from 'fast-safe-stringify';
|
||||
import { CAVEAT_NAMES } from '../../../../shared/constants/permissions';
|
||||
import {
|
||||
HISTORY_STORE_KEY,
|
||||
@ -151,7 +151,7 @@ export default class PermissionsLogController {
|
||||
? LOG_METHOD_TYPES.internal
|
||||
: LOG_METHOD_TYPES.restricted,
|
||||
origin: request.origin,
|
||||
request: cloneDeep(request),
|
||||
request: stringify(request, null, 2),
|
||||
requestTime: Date.now(),
|
||||
response: null,
|
||||
responseTime: null,
|
||||
@ -174,7 +174,7 @@ export default class PermissionsLogController {
|
||||
return;
|
||||
}
|
||||
|
||||
entry.response = cloneDeep(response);
|
||||
entry.response = stringify(response, null, 2);
|
||||
entry.responseTime = time;
|
||||
entry.success = !response.error;
|
||||
}
|
||||
|
@ -134,6 +134,7 @@
|
||||
"extension-port-stream": "^2.0.0",
|
||||
"extensionizer": "^1.0.1",
|
||||
"fast-json-patch": "^2.0.4",
|
||||
"fast-safe-stringify": "^2.0.7",
|
||||
"fuse.js": "^3.2.0",
|
||||
"globalthis": "^1.0.1",
|
||||
"human-standard-token-abi": "^2.0.0",
|
||||
@ -175,7 +176,6 @@
|
||||
"reselect": "^3.0.1",
|
||||
"rpc-cap": "^3.2.1",
|
||||
"safe-event-emitter": "^1.0.1",
|
||||
"safe-json-stringify": "^1.2.0",
|
||||
"single-call-balance-checker-abi": "^1.0.0",
|
||||
"swappable-obj-proxy": "^1.1.0",
|
||||
"textarea-caret": "^3.0.1",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import stringify from 'fast-safe-stringify';
|
||||
|
||||
import { noop } from './mocks';
|
||||
|
||||
@ -84,9 +85,9 @@ function _validateActivityEntry(entry, req, res, methodType, success) {
|
||||
assert.equal(entry.method, req.method);
|
||||
assert.equal(entry.origin, req.origin);
|
||||
assert.equal(entry.methodType, methodType);
|
||||
assert.deepEqual(
|
||||
assert.equal(
|
||||
entry.request,
|
||||
req,
|
||||
stringify(req, null, 2),
|
||||
'entry.request should equal the request',
|
||||
);
|
||||
|
||||
@ -104,7 +105,7 @@ function _validateActivityEntry(entry, req, res, methodType, success) {
|
||||
assert.equal(entry.success, success);
|
||||
assert.deepEqual(
|
||||
entry.response,
|
||||
res,
|
||||
stringify(res, null, 2),
|
||||
'entry.response should equal the response',
|
||||
);
|
||||
} else {
|
||||
|
@ -22131,11 +22131,6 @@ safe-json-parse@~1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/safe-json-parse/-/safe-json-parse-1.0.1.tgz#3e76723e38dfdda13c9b1d29a1e07ffee4b30b57"
|
||||
integrity sha1-PnZyPjjf3aE8mx0poeB//uSzC1c=
|
||||
|
||||
safe-json-stringify@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz#356e44bc98f1f93ce45df14bcd7c01cda86e0afd"
|
||||
integrity sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==
|
||||
|
||||
safe-regex@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e"
|
||||
|
Loading…
Reference in New Issue
Block a user