From 1e29633a38e957e250053478b77f86c6ecc89d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Am=C3=A9lie=20Loulergue?= Date: Thu, 9 Jan 2025 10:25:13 +0100 Subject: [PATCH] add allowed keys in generateFileInfo --- .../validators/oneFileValidators.ts | 2 +- src/api/package-lock.json | 20 +++++++++++-------- src/api/package.json | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/api/middleware/validators/oneFileValidators.ts b/src/api/middleware/validators/oneFileValidators.ts index 588b3ea..277e954 100644 --- a/src/api/middleware/validators/oneFileValidators.ts +++ b/src/api/middleware/validators/oneFileValidators.ts @@ -106,7 +106,7 @@ export const validatorFileSize = async (req: Request, res: Response, next: NextF }; export const generateFileInfo = (body, method = 'PATCH') => { - const keysAllowed = ['external_id', 'expired', 'expiration_date', 'information', ...(method === 'POST' ? ['destination'] : [])]; + const keysAllowed = ['external_id', 'expired', 'expiration_date', 'information', 'signature', 'namespace', 'size', 'base_host', 'base_url', ...(method === 'POST' ? ['destination'] : [])]; const bodyKeys = Object.keys(body.changes ?? body); const hasAllowedKey = bodyKeys.some((key) => keysAllowed.includes(key)); if (hasAllowedKey) { diff --git a/src/api/package-lock.json b/src/api/package-lock.json index 5efb535..9778d85 100644 --- a/src/api/package-lock.json +++ b/src/api/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "cors": "^2.8.5", "dotenv": "^16.4.5", - "express": "^4.17.1", + "express": "4.21.2", "express-rate-limit": "^7.1.5", "form-data": "^4.0.1", "joi": "^17.13.3", @@ -1357,9 +1357,9 @@ "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" }, "node_modules/express": { - "version": "4.21.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", - "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", @@ -1380,7 +1380,7 @@ "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.10", + "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", "qs": "6.13.0", "range-parser": "~1.2.1", @@ -1395,6 +1395,10 @@ }, "engines": { "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/express-rate-limit": { @@ -2107,9 +2111,9 @@ } }, "node_modules/path-to-regexp": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", - "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==" + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==" }, "node_modules/pdf-lib": { "version": "1.17.1", diff --git a/src/api/package.json b/src/api/package.json index b772565..de8bbc0 100644 --- a/src/api/package.json +++ b/src/api/package.json @@ -17,7 +17,7 @@ "dependencies": { "cors": "^2.8.5", "dotenv": "^16.4.5", - "express": "^4.17.1", + "express": "4.21.2", "express-rate-limit": "^7.1.5", "form-data": "^4.0.1", "joi": "^17.13.3",