1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-22 10:22:39 +01:00

Patch body-parser to use json-bigint

This commit is contained in:
Madeline 2022-12-30 23:19:05 +11:00
parent 17e93b7daa
commit 22346c46d0
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
3 changed files with 75 additions and 45 deletions

88
package-lock.json generated
View File

@ -18,7 +18,7 @@
"ajv-formats": "2.1.1", "ajv-formats": "2.1.1",
"amqplib": "^0.10.3", "amqplib": "^0.10.3",
"bcrypt": "^5.0.1", "bcrypt": "^5.0.1",
"body-parser": "^1.20.1", "body-parser": "1.20.1",
"cheerio": "^1.0.0-rc.12", "cheerio": "^1.0.0-rc.12",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"dotenv": "^16.0.2", "dotenv": "^16.0.2",
@ -243,16 +243,16 @@
} }
}, },
"node_modules/@aws-sdk/client-s3": { "node_modules/@aws-sdk/client-s3": {
"version": "3.238.0", "version": "3.241.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.238.0.tgz", "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.241.0.tgz",
"integrity": "sha512-gK8JzwsprnwNjKBUc5/K2dVWQQNK6Dxyhh1IIsJbzj6uurW2K61/mkNNV1h33SAKTubsJYPkq6VwcTrBKtpabg==", "integrity": "sha512-GxkiX4f+FUW2Lr3PySc1wuYlfU8QV2nx6KlBY8L8yf2txtajEL0/hhfo5Pbo4Uw1ZZlTv4iPHUOiTrm2R9Rhyg==",
"dependencies": { "dependencies": {
"@aws-crypto/sha1-browser": "2.0.0", "@aws-crypto/sha1-browser": "2.0.0",
"@aws-crypto/sha256-browser": "2.0.0", "@aws-crypto/sha256-browser": "2.0.0",
"@aws-crypto/sha256-js": "2.0.0", "@aws-crypto/sha256-js": "2.0.0",
"@aws-sdk/client-sts": "3.238.0", "@aws-sdk/client-sts": "3.241.0",
"@aws-sdk/config-resolver": "3.234.0", "@aws-sdk/config-resolver": "3.234.0",
"@aws-sdk/credential-provider-node": "3.238.0", "@aws-sdk/credential-provider-node": "3.241.0",
"@aws-sdk/eventstream-serde-browser": "3.226.0", "@aws-sdk/eventstream-serde-browser": "3.226.0",
"@aws-sdk/eventstream-serde-config-resolver": "3.226.0", "@aws-sdk/eventstream-serde-config-resolver": "3.226.0",
"@aws-sdk/eventstream-serde-node": "3.226.0", "@aws-sdk/eventstream-serde-node": "3.226.0",
@ -290,7 +290,7 @@
"@aws-sdk/util-body-length-node": "3.208.0", "@aws-sdk/util-body-length-node": "3.208.0",
"@aws-sdk/util-defaults-mode-browser": "3.234.0", "@aws-sdk/util-defaults-mode-browser": "3.234.0",
"@aws-sdk/util-defaults-mode-node": "3.234.0", "@aws-sdk/util-defaults-mode-node": "3.234.0",
"@aws-sdk/util-endpoints": "3.226.0", "@aws-sdk/util-endpoints": "3.241.0",
"@aws-sdk/util-retry": "3.229.0", "@aws-sdk/util-retry": "3.229.0",
"@aws-sdk/util-stream-browser": "3.226.0", "@aws-sdk/util-stream-browser": "3.226.0",
"@aws-sdk/util-stream-node": "3.226.0", "@aws-sdk/util-stream-node": "3.226.0",
@ -308,9 +308,9 @@
} }
}, },
"node_modules/@aws-sdk/client-sso": { "node_modules/@aws-sdk/client-sso": {
"version": "3.238.0", "version": "3.241.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.238.0.tgz", "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.241.0.tgz",
"integrity": "sha512-KHJJWP7hBDa9KLYiU5+hOb+3AAba93PhWebXkpKyQ/Bs+e7ECCreyLCwuME6uWTV01NDuFDpwZ6zUMpyNIcP6Q==", "integrity": "sha512-Jm4HR+RYAqKMEYZvvWaq0NYUKKonyInOeubObXH4BLXZpmUBSdYCSjjLdNJY3jkQoxbDVPVMIurVNh5zT5SMRw==",
"dependencies": { "dependencies": {
"@aws-crypto/sha256-browser": "2.0.0", "@aws-crypto/sha256-browser": "2.0.0",
"@aws-crypto/sha256-js": "2.0.0", "@aws-crypto/sha256-js": "2.0.0",
@ -338,7 +338,7 @@
"@aws-sdk/util-body-length-node": "3.208.0", "@aws-sdk/util-body-length-node": "3.208.0",
"@aws-sdk/util-defaults-mode-browser": "3.234.0", "@aws-sdk/util-defaults-mode-browser": "3.234.0",
"@aws-sdk/util-defaults-mode-node": "3.234.0", "@aws-sdk/util-defaults-mode-node": "3.234.0",
"@aws-sdk/util-endpoints": "3.226.0", "@aws-sdk/util-endpoints": "3.241.0",
"@aws-sdk/util-retry": "3.229.0", "@aws-sdk/util-retry": "3.229.0",
"@aws-sdk/util-user-agent-browser": "3.226.0", "@aws-sdk/util-user-agent-browser": "3.226.0",
"@aws-sdk/util-user-agent-node": "3.226.0", "@aws-sdk/util-user-agent-node": "3.226.0",
@ -351,9 +351,9 @@
} }
}, },
"node_modules/@aws-sdk/client-sso-oidc": { "node_modules/@aws-sdk/client-sso-oidc": {
"version": "3.238.0", "version": "3.241.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.238.0.tgz", "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.241.0.tgz",
"integrity": "sha512-kazcA2Kp+cXQRtaZi5/T5YFfU9J3nzu1tXJsh0xAm+J3S9LS1ertY1bSX6KBed2xuxx2mfum8JRqli0TJad/pA==", "integrity": "sha512-/Ml2QBGpGfUEeBrPzBZhSTBkHuXFD2EAZEIHGCBH4tKaURDI6/FoGI8P1Rl4BzoFt+II/Cr91Eox6YT9EwChsQ==",
"dependencies": { "dependencies": {
"@aws-crypto/sha256-browser": "2.0.0", "@aws-crypto/sha256-browser": "2.0.0",
"@aws-crypto/sha256-js": "2.0.0", "@aws-crypto/sha256-js": "2.0.0",
@ -381,7 +381,7 @@
"@aws-sdk/util-body-length-node": "3.208.0", "@aws-sdk/util-body-length-node": "3.208.0",
"@aws-sdk/util-defaults-mode-browser": "3.234.0", "@aws-sdk/util-defaults-mode-browser": "3.234.0",
"@aws-sdk/util-defaults-mode-node": "3.234.0", "@aws-sdk/util-defaults-mode-node": "3.234.0",
"@aws-sdk/util-endpoints": "3.226.0", "@aws-sdk/util-endpoints": "3.241.0",
"@aws-sdk/util-retry": "3.229.0", "@aws-sdk/util-retry": "3.229.0",
"@aws-sdk/util-user-agent-browser": "3.226.0", "@aws-sdk/util-user-agent-browser": "3.226.0",
"@aws-sdk/util-user-agent-node": "3.226.0", "@aws-sdk/util-user-agent-node": "3.226.0",
@ -394,14 +394,14 @@
} }
}, },
"node_modules/@aws-sdk/client-sts": { "node_modules/@aws-sdk/client-sts": {
"version": "3.238.0", "version": "3.241.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.238.0.tgz", "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.241.0.tgz",
"integrity": "sha512-jQNwHqxWUGvWCN4o8KUFYQES8r41Oobu7x1KZOMrPhPxy27FUcDjBq/h85VoD2/AZlETSCZLiCnKV3KBh5pT5w==", "integrity": "sha512-vmlG8cJzRf8skCtTJbA2wBvD2c3NQ5gZryzJvTKDS06KzBzcEpnjlLseuTekcnOiRNekbFUX5hRu5Zj3N2ReLg==",
"dependencies": { "dependencies": {
"@aws-crypto/sha256-browser": "2.0.0", "@aws-crypto/sha256-browser": "2.0.0",
"@aws-crypto/sha256-js": "2.0.0", "@aws-crypto/sha256-js": "2.0.0",
"@aws-sdk/config-resolver": "3.234.0", "@aws-sdk/config-resolver": "3.234.0",
"@aws-sdk/credential-provider-node": "3.238.0", "@aws-sdk/credential-provider-node": "3.241.0",
"@aws-sdk/fetch-http-handler": "3.226.0", "@aws-sdk/fetch-http-handler": "3.226.0",
"@aws-sdk/hash-node": "3.226.0", "@aws-sdk/hash-node": "3.226.0",
"@aws-sdk/invalid-dependency": "3.226.0", "@aws-sdk/invalid-dependency": "3.226.0",
@ -427,7 +427,7 @@
"@aws-sdk/util-body-length-node": "3.208.0", "@aws-sdk/util-body-length-node": "3.208.0",
"@aws-sdk/util-defaults-mode-browser": "3.234.0", "@aws-sdk/util-defaults-mode-browser": "3.234.0",
"@aws-sdk/util-defaults-mode-node": "3.234.0", "@aws-sdk/util-defaults-mode-node": "3.234.0",
"@aws-sdk/util-endpoints": "3.226.0", "@aws-sdk/util-endpoints": "3.241.0",
"@aws-sdk/util-retry": "3.229.0", "@aws-sdk/util-retry": "3.229.0",
"@aws-sdk/util-user-agent-browser": "3.226.0", "@aws-sdk/util-user-agent-browser": "3.226.0",
"@aws-sdk/util-user-agent-node": "3.226.0", "@aws-sdk/util-user-agent-node": "3.226.0",
@ -484,14 +484,14 @@
} }
}, },
"node_modules/@aws-sdk/credential-provider-ini": { "node_modules/@aws-sdk/credential-provider-ini": {
"version": "3.238.0", "version": "3.241.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.238.0.tgz", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.241.0.tgz",
"integrity": "sha512-WmPNtIYyUasjV7VQxvPNq7ihmx0vFsiKAtjNjjakdrt5TPoma4nUYb9tIG9SuG+kcp4DJIgRLJAgZtXbCcVimg==", "integrity": "sha512-CI+mu6h74Kzmscw35TvNkc/wYHsHPGAwP7humSHoWw53H9mVw21Ggft/dT1iFQQZWQ8BNXkzuXlNo1IlqwMgOA==",
"dependencies": { "dependencies": {
"@aws-sdk/credential-provider-env": "3.226.0", "@aws-sdk/credential-provider-env": "3.226.0",
"@aws-sdk/credential-provider-imds": "3.226.0", "@aws-sdk/credential-provider-imds": "3.226.0",
"@aws-sdk/credential-provider-process": "3.226.0", "@aws-sdk/credential-provider-process": "3.226.0",
"@aws-sdk/credential-provider-sso": "3.238.0", "@aws-sdk/credential-provider-sso": "3.241.0",
"@aws-sdk/credential-provider-web-identity": "3.226.0", "@aws-sdk/credential-provider-web-identity": "3.226.0",
"@aws-sdk/property-provider": "3.226.0", "@aws-sdk/property-provider": "3.226.0",
"@aws-sdk/shared-ini-file-loader": "3.226.0", "@aws-sdk/shared-ini-file-loader": "3.226.0",
@ -503,15 +503,15 @@
} }
}, },
"node_modules/@aws-sdk/credential-provider-node": { "node_modules/@aws-sdk/credential-provider-node": {
"version": "3.238.0", "version": "3.241.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.238.0.tgz", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.241.0.tgz",
"integrity": "sha512-/RN5EyGfgdIIJdFzv+O0nSaHX1/F3anQjTIBeVg8GJ+82m+bDxMdALsG+NzkYnLilN9Uhc1lSNjLBCoPa5DSEg==", "integrity": "sha512-08zPQcD5o9brQmzEipWHeHgU85aQcEF8MWLfpeyjO6e1/l7ysQ35NsS+PYtv77nLpGCx/X+ZuW/KXWoRrbw77w==",
"dependencies": { "dependencies": {
"@aws-sdk/credential-provider-env": "3.226.0", "@aws-sdk/credential-provider-env": "3.226.0",
"@aws-sdk/credential-provider-imds": "3.226.0", "@aws-sdk/credential-provider-imds": "3.226.0",
"@aws-sdk/credential-provider-ini": "3.238.0", "@aws-sdk/credential-provider-ini": "3.241.0",
"@aws-sdk/credential-provider-process": "3.226.0", "@aws-sdk/credential-provider-process": "3.226.0",
"@aws-sdk/credential-provider-sso": "3.238.0", "@aws-sdk/credential-provider-sso": "3.241.0",
"@aws-sdk/credential-provider-web-identity": "3.226.0", "@aws-sdk/credential-provider-web-identity": "3.226.0",
"@aws-sdk/property-provider": "3.226.0", "@aws-sdk/property-provider": "3.226.0",
"@aws-sdk/shared-ini-file-loader": "3.226.0", "@aws-sdk/shared-ini-file-loader": "3.226.0",
@ -537,14 +537,14 @@
} }
}, },
"node_modules/@aws-sdk/credential-provider-sso": { "node_modules/@aws-sdk/credential-provider-sso": {
"version": "3.238.0", "version": "3.241.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.238.0.tgz", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.241.0.tgz",
"integrity": "sha512-i70V4bFlCVYey3QARJ6XxKEg/4YuoFRnePV2oK37UHOGpEn49uXKwVZqLjzJgFHln7BPlC06cWDqrHUQIMvYrQ==", "integrity": "sha512-6Bjd6eEIrVomRTrPrM4dlxusQm+KMJ9hLYKECCpFkwDKIK+pTgZNLRtQdalHyzwneHJPdimrm8cOv1kUQ8hPoA==",
"dependencies": { "dependencies": {
"@aws-sdk/client-sso": "3.238.0", "@aws-sdk/client-sso": "3.241.0",
"@aws-sdk/property-provider": "3.226.0", "@aws-sdk/property-provider": "3.226.0",
"@aws-sdk/shared-ini-file-loader": "3.226.0", "@aws-sdk/shared-ini-file-loader": "3.226.0",
"@aws-sdk/token-providers": "3.238.0", "@aws-sdk/token-providers": "3.241.0",
"@aws-sdk/types": "3.226.0", "@aws-sdk/types": "3.226.0",
"tslib": "^2.3.1" "tslib": "^2.3.1"
}, },
@ -1093,11 +1093,11 @@
} }
}, },
"node_modules/@aws-sdk/token-providers": { "node_modules/@aws-sdk/token-providers": {
"version": "3.238.0", "version": "3.241.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.238.0.tgz", "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.241.0.tgz",
"integrity": "sha512-vYUwmy0kTzA99mJCVvad+/5RDlWve/xxnppT8DJK3JIdAgskp+rULY+joVnq2NSl489UAioUnFGs57vUxi8Pog==", "integrity": "sha512-79okvuOS7V559OIL/RalIPG98wzmWxeFOChFnbEjn2pKOyGQ6FJRwLPYZaVRtNdAtnkBNgRpmFq9dX843QxhtQ==",
"dependencies": { "dependencies": {
"@aws-sdk/client-sso-oidc": "3.238.0", "@aws-sdk/client-sso-oidc": "3.241.0",
"@aws-sdk/property-provider": "3.226.0", "@aws-sdk/property-provider": "3.226.0",
"@aws-sdk/shared-ini-file-loader": "3.226.0", "@aws-sdk/shared-ini-file-loader": "3.226.0",
"@aws-sdk/types": "3.226.0", "@aws-sdk/types": "3.226.0",
@ -1224,9 +1224,9 @@
} }
}, },
"node_modules/@aws-sdk/util-endpoints": { "node_modules/@aws-sdk/util-endpoints": {
"version": "3.226.0", "version": "3.241.0",
"resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.226.0.tgz", "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.241.0.tgz",
"integrity": "sha512-iqOkac/zLmyPBUJd7SLN0PeZMkOmlGgD5PHmmekTClOkce2eUjK9SNX1PzL73aXPoPTyhg9QGLH8uEZEQ8YUzg==", "integrity": "sha512-jVf8bKrN22Ey0xLmj75sL7EUvm5HFpuOMkXsZkuXycKhCwLBcEUWlvtJYtRjOU1zScPQv9GMJd2QXQglp34iOQ==",
"dependencies": { "dependencies": {
"@aws-sdk/types": "3.226.0", "@aws-sdk/types": "3.226.0",
"tslib": "^2.3.1" "tslib": "^2.3.1"
@ -1870,9 +1870,9 @@
} }
}, },
"node_modules/@types/ws": { "node_modules/@types/ws": {
"version": "8.5.3", "version": "8.5.4",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.4.tgz",
"integrity": "sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==", "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/node": "*" "@types/node": "*"

View File

@ -62,7 +62,7 @@
"ajv-formats": "2.1.1", "ajv-formats": "2.1.1",
"amqplib": "^0.10.3", "amqplib": "^0.10.3",
"bcrypt": "^5.0.1", "bcrypt": "^5.0.1",
"body-parser": "^1.20.1", "body-parser": "1.20.1",
"cheerio": "^1.0.0-rc.12", "cheerio": "^1.0.0-rc.12",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"dotenv": "^16.0.2", "dotenv": "^16.0.2",

View File

@ -0,0 +1,30 @@
diff --git a/node_modules/body-parser/lib/types/json.js b/node_modules/body-parser/lib/types/json.js
index c2745be..7104cfa 100644
--- a/node_modules/body-parser/lib/types/json.js
+++ b/node_modules/body-parser/lib/types/json.js
@@ -18,6 +18,7 @@ var createError = require('http-errors')
var debug = require('debug')('body-parser:json')
var read = require('../read')
var typeis = require('type-is')
+var JSONbig = require("json-bigint");
/**
* Module exports.
@@ -86,7 +87,7 @@ function json (options) {
try {
debug('parse json')
- return JSON.parse(body, reviver)
+ return JSONbig.parse(body, reviver)
} catch (e) {
throw normalizeJsonSyntaxError(e, {
message: e.message,
@@ -157,7 +158,7 @@ function createStrictSyntaxError (str, char) {
: ''
try {
- JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
+ JSONbig.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
} catch (e) {
return normalizeJsonSyntaxError(e, {
message: e.message.replace('#', char),