Sfoglia il codice sorgente

Merge pull request #16749 from overleaf/td-upgrade-joi-celebrate

Upgrade Joi and Celebrate to latest

GitOrigin-RevId: 287130f6e476c04f9eb4efdf202729452b081c40
Tim Down 2 anni fa
parent
commit
473e74ecf1

+ 46 - 418
package-lock.json

@@ -6135,20 +6135,6 @@
         "node": ">=10.13.0"
       }
     },
-    "node_modules/@hapi/address": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/@hapi/address/-/address-4.1.0.tgz",
-      "integrity": "sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==",
-      "deprecated": "Moved to 'npm install @sideway/address'",
-      "dependencies": {
-        "@hapi/hoek": "^9.0.0"
-      }
-    },
-    "node_modules/@hapi/address/node_modules/@hapi/hoek": {
-      "version": "9.2.1",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-      "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-    },
     "node_modules/@hapi/b64": {
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/@hapi/b64/-/b64-5.0.0.tgz",
@@ -6157,11 +6143,6 @@
         "@hapi/hoek": "9.x.x"
       }
     },
-    "node_modules/@hapi/b64/node_modules/@hapi/hoek": {
-      "version": "9.3.0",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-      "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
-    },
     "node_modules/@hapi/boom": {
       "version": "9.1.4",
       "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz",
@@ -6170,17 +6151,6 @@
         "@hapi/hoek": "9.x.x"
       }
     },
-    "node_modules/@hapi/boom/node_modules/@hapi/hoek": {
-      "version": "9.3.0",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-      "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
-    },
-    "node_modules/@hapi/bourne": {
-      "version": "1.3.2",
-      "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz",
-      "integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==",
-      "deprecated": "This version has been deprecated and is no longer supported or maintained"
-    },
     "node_modules/@hapi/cryptiles": {
       "version": "5.1.0",
       "resolved": "https://registry.npmjs.org/@hapi/cryptiles/-/cryptiles-5.1.0.tgz",
@@ -6192,17 +6162,10 @@
         "node": ">=12.0.0"
       }
     },
-    "node_modules/@hapi/formula": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-2.0.0.tgz",
-      "integrity": "sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A==",
-      "deprecated": "Moved to 'npm install @sideway/formula'"
-    },
     "node_modules/@hapi/hoek": {
-      "version": "8.5.1",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz",
-      "integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow==",
-      "deprecated": "This version has been deprecated and is no longer supported or maintained"
+      "version": "9.3.0",
+      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
+      "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
     },
     "node_modules/@hapi/iron": {
       "version": "6.0.0",
@@ -6221,35 +6184,6 @@
       "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.1.0.tgz",
       "integrity": "sha512-i1BpaNDVLJdRBEKeJWkVO6tYX6DMFBuwMhSuWqLsY4ufeTKGVuV5rBsUhxPayXqnnWHgXUAmWK16H/ykO5Wj4Q=="
     },
-    "node_modules/@hapi/iron/node_modules/@hapi/hoek": {
-      "version": "9.3.0",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-      "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
-    },
-    "node_modules/@hapi/joi": {
-      "version": "17.1.1",
-      "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-17.1.1.tgz",
-      "integrity": "sha512-p4DKeZAoeZW4g3u7ZeRo+vCDuSDgSvtsB/NpfjXEHTUjSeINAi/RrVOWiVQ1isaoLzMvFEhe8n5065mQq1AdQg==",
-      "deprecated": "Switch to 'npm install joi'",
-      "dependencies": {
-        "@hapi/address": "^4.0.1",
-        "@hapi/formula": "^2.0.0",
-        "@hapi/hoek": "^9.0.0",
-        "@hapi/pinpoint": "^2.0.0",
-        "@hapi/topo": "^5.0.0"
-      }
-    },
-    "node_modules/@hapi/joi/node_modules/@hapi/hoek": {
-      "version": "9.2.1",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-      "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-    },
-    "node_modules/@hapi/pinpoint": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-2.0.0.tgz",
-      "integrity": "sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw==",
-      "deprecated": "Moved to 'npm install @sideway/pinpoint'"
-    },
     "node_modules/@hapi/podium": {
       "version": "4.1.3",
       "resolved": "https://registry.npmjs.org/@hapi/podium/-/podium-4.1.3.tgz",
@@ -6260,11 +6194,6 @@
         "@hapi/validate": "1.x.x"
       }
     },
-    "node_modules/@hapi/podium/node_modules/@hapi/hoek": {
-      "version": "9.3.0",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-      "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
-    },
     "node_modules/@hapi/teamwork": {
       "version": "5.1.1",
       "resolved": "https://registry.npmjs.org/@hapi/teamwork/-/teamwork-5.1.1.tgz",
@@ -6281,11 +6210,6 @@
         "@hapi/hoek": "^9.0.0"
       }
     },
-    "node_modules/@hapi/topo/node_modules/@hapi/hoek": {
-      "version": "9.2.1",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-      "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-    },
     "node_modules/@hapi/validate": {
       "version": "1.1.3",
       "resolved": "https://registry.npmjs.org/@hapi/validate/-/validate-1.1.3.tgz",
@@ -6295,11 +6219,6 @@
         "@hapi/topo": "^5.0.0"
       }
     },
-    "node_modules/@hapi/validate/node_modules/@hapi/hoek": {
-      "version": "9.3.0",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-      "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
-    },
     "node_modules/@hapi/wreck": {
       "version": "18.0.1",
       "resolved": "https://registry.npmjs.org/@hapi/wreck/-/wreck-18.0.1.tgz",
@@ -10157,18 +10076,13 @@
       "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
     },
     "node_modules/@sideway/address": {
-      "version": "4.1.3",
-      "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.3.tgz",
-      "integrity": "sha512-8ncEUtmnTsMmL7z1YPB47kPUq7LpKWJNFPsRzHiIajGC5uXlWGn+AmkYPcHNl8S4tcEGx+cnORnNYaw2wvL+LQ==",
+      "version": "4.1.4",
+      "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz",
+      "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==",
       "dependencies": {
         "@hapi/hoek": "^9.0.0"
       }
     },
-    "node_modules/@sideway/address/node_modules/@hapi/hoek": {
-      "version": "9.2.1",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-      "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-    },
     "node_modules/@sideway/formula": {
       "version": "3.0.1",
       "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz",
@@ -15703,11 +15617,6 @@
         "joi": "^17.3.0"
       }
     },
-    "node_modules/@types/hapi__joi": {
-      "version": "17.1.8",
-      "resolved": "https://registry.npmjs.org/@types/hapi__joi/-/hapi__joi-17.1.8.tgz",
-      "integrity": "sha512-omVytnOAiAfzGUOQArujJr3heWxPrDHW7MF1ieqix1ngoGdhtJmSSDFVM+ZAOa7UmhlGJtltdgUAT03mfDu6kg=="
-    },
     "node_modules/@types/hapi__mimos": {
       "version": "4.1.4",
       "resolved": "https://registry.npmjs.org/@types/hapi__mimos/-/hapi__mimos-4.1.4.tgz",
@@ -19254,13 +19163,12 @@
       }
     },
     "node_modules/celebrate": {
-      "version": "12.2.0",
-      "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-12.2.0.tgz",
-      "integrity": "sha512-dkcQaUL4zrPOua/NwTM74jf/NY3wv9Fyb1mkC2ru75KRHowSIDe/tJtIG9yRyPyFCfkr1odif8zNQq23eTwEYg==",
+      "version": "15.0.3",
+      "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-15.0.3.tgz",
+      "integrity": "sha512-ToF8ILq/F0KhQ0CPtexP7Cu9GkqKJ91VKy3ZOCV24aaNWdm3QCHqnXAKfKHrtcM2B2zmPFe11p8WWsQkmq8k4g==",
       "dependencies": {
-        "@hapi/joi": "17.x.x",
-        "@types/hapi__joi": "17.x.x",
         "escape-html": "1.0.3",
+        "joi": "17.x.x",
         "lodash": "4.17.x"
       }
     },
@@ -29006,22 +28914,17 @@
       }
     },
     "node_modules/joi": {
-      "version": "17.9.2",
-      "resolved": "https://registry.npmjs.org/joi/-/joi-17.9.2.tgz",
-      "integrity": "sha512-Itk/r+V4Dx0V3c7RLFdRh12IOjySm2/WGPMubBT92cQvRfYZhPM2W0hZlctjj72iES8jsRCwp7S/cRmWBnJ4nw==",
+      "version": "17.12.0",
+      "resolved": "https://registry.npmjs.org/joi/-/joi-17.12.0.tgz",
+      "integrity": "sha512-HSLsmSmXz+PV9PYoi3p7cgIbj06WnEBNT28n+bbBNcPZXZFqCzzvGqpTBPujx/Z0nh1+KNQPDrNgdmQ8dq0qYw==",
       "dependencies": {
-        "@hapi/hoek": "^9.0.0",
-        "@hapi/topo": "^5.0.0",
-        "@sideway/address": "^4.1.3",
+        "@hapi/hoek": "^9.3.0",
+        "@hapi/topo": "^5.1.0",
+        "@sideway/address": "^4.1.4",
         "@sideway/formula": "^3.0.1",
         "@sideway/pinpoint": "^2.0.0"
       }
     },
-    "node_modules/joi/node_modules/@hapi/hoek": {
-      "version": "9.2.1",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-      "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-    },
     "node_modules/jose": {
       "version": "4.11.2",
       "resolved": "https://registry.npmjs.org/jose/-/jose-4.11.2.tgz",
@@ -43099,11 +43002,11 @@
         "body-parser": "^1.19.0",
         "bull": "^3.18.0",
         "camelcase-keys": "^4.2.0",
-        "celebrate": "^12.1.1",
+        "celebrate": "^15.0.3",
         "csv": "^5.4.0",
         "east": "^2.0.3",
         "express": "^4.18.2",
-        "joi": "^17.2.1",
+        "joi": "^17.12.0",
         "json2csv": "^4.5.4",
         "lodash": "^4.17.21",
         "minimist": "^1.2.7",
@@ -43561,7 +43464,7 @@
         "body-parser": "^1.19.0",
         "bson": "^1.1.4",
         "bunyan": "^1.8.15",
-        "celebrate": "^13.0.4",
+        "celebrate": "^15.0.3",
         "express": "^4.18.2",
         "lodash": "^4.17.21",
         "mongodb": "^6.2.0",
@@ -43580,16 +43483,6 @@
         "typescript": "^5.0.4"
       }
     },
-    "services/docstore/node_modules/celebrate": {
-      "version": "13.0.4",
-      "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-13.0.4.tgz",
-      "integrity": "sha512-gUtAjEtFyY9PvuuQJq1uyuF46gLetVZzyUKXBDBqqvgzCjTSfwXP8L+WcGt1NrLQvUxXdlzhFolW2Bt9DDEV+g==",
-      "dependencies": {
-        "escape-html": "1.0.3",
-        "joi": "17.x.x",
-        "lodash": "4.17.x"
-      }
-    },
     "services/docstore/node_modules/diff": {
       "version": "4.0.2",
       "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
@@ -45576,7 +45469,7 @@
         "body-parser": "^1.19.0",
         "bunyan": "^1.8.15",
         "byline": "^4.2.1",
-        "celebrate": "^10.1.0",
+        "celebrate": "^15.0.3",
         "cli": "^1.0.1",
         "diff-match-patch": "overleaf/diff-match-patch#89805f9c671a77a263fc53461acd62aa7498f688",
         "esmock": "^2.1.0",
@@ -45602,46 +45495,6 @@
         "typescript": "^5.0.4"
       }
     },
-    "services/project-history/node_modules/@hapi/address": {
-      "version": "2.1.4",
-      "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
-      "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==",
-      "deprecated": "Moved to 'npm install @sideway/address'"
-    },
-    "services/project-history/node_modules/@hapi/joi": {
-      "version": "15.1.1",
-      "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-15.1.1.tgz",
-      "integrity": "sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ==",
-      "deprecated": "Switch to 'npm install joi'",
-      "dependencies": {
-        "@hapi/address": "2.x.x",
-        "@hapi/bourne": "1.x.x",
-        "@hapi/hoek": "8.x.x",
-        "@hapi/topo": "3.x.x"
-      }
-    },
-    "services/project-history/node_modules/@hapi/topo": {
-      "version": "3.1.6",
-      "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz",
-      "integrity": "sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ==",
-      "deprecated": "This version has been deprecated and is no longer supported or maintained",
-      "dependencies": {
-        "@hapi/hoek": "^8.3.0"
-      }
-    },
-    "services/project-history/node_modules/celebrate": {
-      "version": "10.1.0",
-      "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-10.1.0.tgz",
-      "integrity": "sha512-Ybkb+/mek6nl4HZljFGUtma8r1Dq0ClYiHf5RVV3msoDFRsJlAFIR8J6+dKwL4EhgihIPFdBOMc6KFO9izMA9g==",
-      "dependencies": {
-        "@hapi/joi": "15.x.x",
-        "escape-html": "1.0.3",
-        "lodash.get": "4.4.x"
-      },
-      "engines": {
-        "node": ">=8.9.0"
-      }
-    },
     "services/project-history/node_modules/debug": {
       "version": "4.3.4",
       "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -45732,7 +45585,6 @@
     "services/real-time": {
       "name": "@overleaf/real-time",
       "dependencies": {
-        "@hapi/joi": "^17.1.1",
         "@overleaf/logger": "*",
         "@overleaf/metrics": "*",
         "@overleaf/o-error": "*",
@@ -45746,6 +45598,7 @@
         "cookie-parser": "^1.4.5",
         "express": "^4.18.2",
         "express-session": "^1.17.1",
+        "joi": "^17.12.0",
         "proxy-addr": "^2.0.7",
         "request": "^2.88.2",
         "socket.io": "github:overleaf/socket.io#0.9.19-overleaf-10",
@@ -46232,7 +46085,7 @@
         "bull": "^3.18.0",
         "bunyan": "^1.8.15",
         "cache-flow": "^1.9.0",
-        "celebrate": "^10.0.1",
+        "celebrate": "^15.0.3",
         "connect-redis": "^6.1.3",
         "content-disposition": "^0.5.0",
         "contentful": "^6.1.1",
@@ -46256,6 +46109,7 @@
         "i18next": "^23.5.1",
         "i18next-fs-backend": "^2.2.0",
         "i18next-http-middleware": "^3.4.1",
+        "joi": "^17.12.0",
         "jose": "^4.3.8",
         "json2csv": "^4.3.3",
         "jsonwebtoken": "^9.0.0",
@@ -46587,33 +46441,6 @@
         "node": ">=12"
       }
     },
-    "services/web/node_modules/@hapi/address": {
-      "version": "2.1.4",
-      "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
-      "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==",
-      "deprecated": "Moved to 'npm install @sideway/address'"
-    },
-    "services/web/node_modules/@hapi/joi": {
-      "version": "15.1.1",
-      "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-15.1.1.tgz",
-      "integrity": "sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ==",
-      "deprecated": "Switch to 'npm install joi'",
-      "dependencies": {
-        "@hapi/address": "2.x.x",
-        "@hapi/bourne": "1.x.x",
-        "@hapi/hoek": "8.x.x",
-        "@hapi/topo": "3.x.x"
-      }
-    },
-    "services/web/node_modules/@hapi/topo": {
-      "version": "3.1.6",
-      "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz",
-      "integrity": "sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ==",
-      "deprecated": "This version has been deprecated and is no longer supported or maintained",
-      "dependencies": {
-        "@hapi/hoek": "^8.3.0"
-      }
-    },
     "services/web/node_modules/@opentelemetry/auto-instrumentations-web": {
       "version": "0.33.1",
       "resolved": "https://registry.npmjs.org/@opentelemetry/auto-instrumentations-web/-/auto-instrumentations-web-0.33.1.tgz",
@@ -47243,19 +47070,6 @@
         "node": ">=10.16.0"
       }
     },
-    "services/web/node_modules/celebrate": {
-      "version": "10.1.0",
-      "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-10.1.0.tgz",
-      "integrity": "sha512-Ybkb+/mek6nl4HZljFGUtma8r1Dq0ClYiHf5RVV3msoDFRsJlAFIR8J6+dKwL4EhgihIPFdBOMc6KFO9izMA9g==",
-      "dependencies": {
-        "@hapi/joi": "15.x.x",
-        "escape-html": "1.0.3",
-        "lodash.get": "4.4.x"
-      },
-      "engines": {
-        "node": ">=8.9.0"
-      }
-    },
     "services/web/node_modules/chalk": {
       "version": "4.1.2",
       "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -51823,34 +51637,12 @@
         "is-negated-glob": "^1.0.0"
       }
     },
-    "@hapi/address": {
-      "version": "4.1.0",
-      "resolved": "https://registry.npmjs.org/@hapi/address/-/address-4.1.0.tgz",
-      "integrity": "sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==",
-      "requires": {
-        "@hapi/hoek": "^9.0.0"
-      },
-      "dependencies": {
-        "@hapi/hoek": {
-          "version": "9.2.1",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-          "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-        }
-      }
-    },
     "@hapi/b64": {
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/@hapi/b64/-/b64-5.0.0.tgz",
       "integrity": "sha512-ngu0tSEmrezoiIaNGG6rRvKOUkUuDdf4XTPnONHGYfSGRmDqPZX5oJL6HAdKTo1UQHECbdB4OzhWrfgVppjHUw==",
       "requires": {
         "@hapi/hoek": "9.x.x"
-      },
-      "dependencies": {
-        "@hapi/hoek": {
-          "version": "9.3.0",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-          "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
-        }
       }
     },
     "@hapi/boom": {
@@ -51859,20 +51651,8 @@
       "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==",
       "requires": {
         "@hapi/hoek": "9.x.x"
-      },
-      "dependencies": {
-        "@hapi/hoek": {
-          "version": "9.3.0",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-          "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
-        }
       }
     },
-    "@hapi/bourne": {
-      "version": "1.3.2",
-      "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz",
-      "integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA=="
-    },
     "@hapi/cryptiles": {
       "version": "5.1.0",
       "resolved": "https://registry.npmjs.org/@hapi/cryptiles/-/cryptiles-5.1.0.tgz",
@@ -51881,15 +51661,10 @@
         "@hapi/boom": "9.x.x"
       }
     },
-    "@hapi/formula": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-2.0.0.tgz",
-      "integrity": "sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A=="
-    },
     "@hapi/hoek": {
-      "version": "8.5.1",
-      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz",
-      "integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow=="
+      "version": "9.3.0",
+      "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
+      "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
     },
     "@hapi/iron": {
       "version": "6.0.0",
@@ -51907,38 +51682,9 @@
           "version": "2.1.0",
           "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-2.1.0.tgz",
           "integrity": "sha512-i1BpaNDVLJdRBEKeJWkVO6tYX6DMFBuwMhSuWqLsY4ufeTKGVuV5rBsUhxPayXqnnWHgXUAmWK16H/ykO5Wj4Q=="
-        },
-        "@hapi/hoek": {
-          "version": "9.3.0",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-          "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
         }
       }
     },
-    "@hapi/joi": {
-      "version": "17.1.1",
-      "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-17.1.1.tgz",
-      "integrity": "sha512-p4DKeZAoeZW4g3u7ZeRo+vCDuSDgSvtsB/NpfjXEHTUjSeINAi/RrVOWiVQ1isaoLzMvFEhe8n5065mQq1AdQg==",
-      "requires": {
-        "@hapi/address": "^4.0.1",
-        "@hapi/formula": "^2.0.0",
-        "@hapi/hoek": "^9.0.0",
-        "@hapi/pinpoint": "^2.0.0",
-        "@hapi/topo": "^5.0.0"
-      },
-      "dependencies": {
-        "@hapi/hoek": {
-          "version": "9.2.1",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-          "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-        }
-      }
-    },
-    "@hapi/pinpoint": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-2.0.0.tgz",
-      "integrity": "sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw=="
-    },
     "@hapi/podium": {
       "version": "4.1.3",
       "resolved": "https://registry.npmjs.org/@hapi/podium/-/podium-4.1.3.tgz",
@@ -51947,13 +51693,6 @@
         "@hapi/hoek": "9.x.x",
         "@hapi/teamwork": "5.x.x",
         "@hapi/validate": "1.x.x"
-      },
-      "dependencies": {
-        "@hapi/hoek": {
-          "version": "9.3.0",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-          "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
-        }
       }
     },
     "@hapi/teamwork": {
@@ -51967,13 +51706,6 @@
       "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==",
       "requires": {
         "@hapi/hoek": "^9.0.0"
-      },
-      "dependencies": {
-        "@hapi/hoek": {
-          "version": "9.2.1",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-          "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-        }
       }
     },
     "@hapi/validate": {
@@ -51983,13 +51715,6 @@
       "requires": {
         "@hapi/hoek": "^9.0.0",
         "@hapi/topo": "^5.0.0"
-      },
-      "dependencies": {
-        "@hapi/hoek": {
-          "version": "9.3.0",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",
-          "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ=="
-        }
       }
     },
     "@hapi/wreck": {
@@ -53800,13 +53525,13 @@
         "body-parser": "^1.19.0",
         "bull": "^3.18.0",
         "camelcase-keys": "^4.2.0",
-        "celebrate": "^12.1.1",
+        "celebrate": "^15.0.3",
         "chai": "^4.3.6",
         "chai-as-promised": "^7.1.1",
         "csv": "^5.4.0",
         "east": "^2.0.3",
         "express": "^4.18.2",
-        "joi": "^17.2.1",
+        "joi": "^17.12.0",
         "json2csv": "^4.5.4",
         "lodash": "^4.17.21",
         "minimist": "^1.2.7",
@@ -54113,7 +53838,7 @@
         "body-parser": "^1.19.0",
         "bson": "^1.1.4",
         "bunyan": "^1.8.15",
-        "celebrate": "^13.0.4",
+        "celebrate": "^15.0.3",
         "chai": "^4.3.6",
         "chai-as-promised": "^7.1.1",
         "express": "^4.18.2",
@@ -54129,16 +53854,6 @@
         "typescript": "^5.0.4"
       },
       "dependencies": {
-        "celebrate": {
-          "version": "13.0.4",
-          "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-13.0.4.tgz",
-          "integrity": "sha512-gUtAjEtFyY9PvuuQJq1uyuF46gLetVZzyUKXBDBqqvgzCjTSfwXP8L+WcGt1NrLQvUxXdlzhFolW2Bt9DDEV+g==",
-          "requires": {
-            "escape-html": "1.0.3",
-            "joi": "17.x.x",
-            "lodash": "4.17.x"
-          }
-        },
         "diff": {
           "version": "4.0.2",
           "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
@@ -54747,7 +54462,7 @@
         "body-parser": "^1.19.0",
         "bunyan": "^1.8.15",
         "byline": "^4.2.1",
-        "celebrate": "^10.1.0",
+        "celebrate": "^15.0.3",
         "chai": "^4.3.6",
         "chai-as-promised": "^7.1.1",
         "cli": "^1.0.1",
@@ -54771,40 +54486,6 @@
         "typescript": "^5.0.4"
       },
       "dependencies": {
-        "@hapi/address": {
-          "version": "2.1.4",
-          "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
-          "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ=="
-        },
-        "@hapi/joi": {
-          "version": "15.1.1",
-          "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-15.1.1.tgz",
-          "integrity": "sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ==",
-          "requires": {
-            "@hapi/address": "2.x.x",
-            "@hapi/bourne": "1.x.x",
-            "@hapi/hoek": "8.x.x",
-            "@hapi/topo": "3.x.x"
-          }
-        },
-        "@hapi/topo": {
-          "version": "3.1.6",
-          "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz",
-          "integrity": "sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ==",
-          "requires": {
-            "@hapi/hoek": "^8.3.0"
-          }
-        },
-        "celebrate": {
-          "version": "10.1.0",
-          "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-10.1.0.tgz",
-          "integrity": "sha512-Ybkb+/mek6nl4HZljFGUtma8r1Dq0ClYiHf5RVV3msoDFRsJlAFIR8J6+dKwL4EhgihIPFdBOMc6KFO9izMA9g==",
-          "requires": {
-            "@hapi/joi": "15.x.x",
-            "escape-html": "1.0.3",
-            "lodash.get": "4.4.x"
-          }
-        },
         "debug": {
           "version": "4.3.4",
           "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -54926,7 +54607,6 @@
     "@overleaf/real-time": {
       "version": "file:services/real-time",
       "requires": {
-        "@hapi/joi": "^17.1.1",
         "@overleaf/logger": "*",
         "@overleaf/metrics": "*",
         "@overleaf/o-error": "*",
@@ -54943,6 +54623,7 @@
         "cookie-signature": "^1.1.0",
         "express": "^4.18.2",
         "express-session": "^1.17.1",
+        "joi": "^17.12.0",
         "mocha": "^10.2.0",
         "proxy-addr": "^2.0.7",
         "request": "^2.88.2",
@@ -55426,7 +55107,7 @@
         "bunyan": "^1.8.15",
         "c8": "^7.2.0",
         "cache-flow": "^1.9.0",
-        "celebrate": "^10.0.1",
+        "celebrate": "^15.0.3",
         "chai": "^4.3.6",
         "chai-as-promised": "^7.1.1",
         "chai-exclude": "^2.0.3",
@@ -55483,6 +55164,7 @@
         "i18next-fs-backend": "^2.2.0",
         "i18next-http-middleware": "^3.4.1",
         "i18next-scanner": "^4.4.0",
+        "joi": "^17.12.0",
         "jose": "^4.3.8",
         "jquery": "^2.2.4",
         "jsdom": "^19.0.0",
@@ -55664,30 +55346,6 @@
           "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-3.0.1.tgz",
           "integrity": "sha512-z1CjRjtQyBOYL+5Qr9DdYIfrdLBe746jRTYfaYU6MeXkqp7UfYs/jX16lFFVzZ7PGEJvqZNqYUEtb1mvDww4pA=="
         },
-        "@hapi/address": {
-          "version": "2.1.4",
-          "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
-          "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ=="
-        },
-        "@hapi/joi": {
-          "version": "15.1.1",
-          "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-15.1.1.tgz",
-          "integrity": "sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ==",
-          "requires": {
-            "@hapi/address": "2.x.x",
-            "@hapi/bourne": "1.x.x",
-            "@hapi/hoek": "8.x.x",
-            "@hapi/topo": "3.x.x"
-          }
-        },
-        "@hapi/topo": {
-          "version": "3.1.6",
-          "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz",
-          "integrity": "sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ==",
-          "requires": {
-            "@hapi/hoek": "^8.3.0"
-          }
-        },
         "@opentelemetry/auto-instrumentations-web": {
           "version": "0.33.1",
           "resolved": "https://registry.npmjs.org/@opentelemetry/auto-instrumentations-web/-/auto-instrumentations-web-0.33.1.tgz",
@@ -56121,16 +55779,6 @@
             "streamsearch": "^1.1.0"
           }
         },
-        "celebrate": {
-          "version": "10.1.0",
-          "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-10.1.0.tgz",
-          "integrity": "sha512-Ybkb+/mek6nl4HZljFGUtma8r1Dq0ClYiHf5RVV3msoDFRsJlAFIR8J6+dKwL4EhgihIPFdBOMc6KFO9izMA9g==",
-          "requires": {
-            "@hapi/joi": "15.x.x",
-            "escape-html": "1.0.3",
-            "lodash.get": "4.4.x"
-          }
-        },
         "chalk": {
           "version": "4.1.2",
           "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -57525,18 +57173,11 @@
       }
     },
     "@sideway/address": {
-      "version": "4.1.3",
-      "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.3.tgz",
-      "integrity": "sha512-8ncEUtmnTsMmL7z1YPB47kPUq7LpKWJNFPsRzHiIajGC5uXlWGn+AmkYPcHNl8S4tcEGx+cnORnNYaw2wvL+LQ==",
+      "version": "4.1.4",
+      "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz",
+      "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==",
       "requires": {
         "@hapi/hoek": "^9.0.0"
-      },
-      "dependencies": {
-        "@hapi/hoek": {
-          "version": "9.2.1",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-          "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-        }
       }
     },
     "@sideway/formula": {
@@ -61677,11 +61318,6 @@
         "joi": "^17.3.0"
       }
     },
-    "@types/hapi__joi": {
-      "version": "17.1.8",
-      "resolved": "https://registry.npmjs.org/@types/hapi__joi/-/hapi__joi-17.1.8.tgz",
-      "integrity": "sha512-omVytnOAiAfzGUOQArujJr3heWxPrDHW7MF1ieqix1ngoGdhtJmSSDFVM+ZAOa7UmhlGJtltdgUAT03mfDu6kg=="
-    },
     "@types/hapi__mimos": {
       "version": "4.1.4",
       "resolved": "https://registry.npmjs.org/@types/hapi__mimos/-/hapi__mimos-4.1.4.tgz",
@@ -64563,13 +64199,12 @@
       }
     },
     "celebrate": {
-      "version": "12.2.0",
-      "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-12.2.0.tgz",
-      "integrity": "sha512-dkcQaUL4zrPOua/NwTM74jf/NY3wv9Fyb1mkC2ru75KRHowSIDe/tJtIG9yRyPyFCfkr1odif8zNQq23eTwEYg==",
+      "version": "15.0.3",
+      "resolved": "https://registry.npmjs.org/celebrate/-/celebrate-15.0.3.tgz",
+      "integrity": "sha512-ToF8ILq/F0KhQ0CPtexP7Cu9GkqKJ91VKy3ZOCV24aaNWdm3QCHqnXAKfKHrtcM2B2zmPFe11p8WWsQkmq8k4g==",
       "requires": {
-        "@hapi/joi": "17.x.x",
-        "@types/hapi__joi": "17.x.x",
         "escape-html": "1.0.3",
+        "joi": "17.x.x",
         "lodash": "4.17.x"
       }
     },
@@ -71944,22 +71579,15 @@
       "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw=="
     },
     "joi": {
-      "version": "17.9.2",
-      "resolved": "https://registry.npmjs.org/joi/-/joi-17.9.2.tgz",
-      "integrity": "sha512-Itk/r+V4Dx0V3c7RLFdRh12IOjySm2/WGPMubBT92cQvRfYZhPM2W0hZlctjj72iES8jsRCwp7S/cRmWBnJ4nw==",
+      "version": "17.12.0",
+      "resolved": "https://registry.npmjs.org/joi/-/joi-17.12.0.tgz",
+      "integrity": "sha512-HSLsmSmXz+PV9PYoi3p7cgIbj06WnEBNT28n+bbBNcPZXZFqCzzvGqpTBPujx/Z0nh1+KNQPDrNgdmQ8dq0qYw==",
       "requires": {
-        "@hapi/hoek": "^9.0.0",
-        "@hapi/topo": "^5.0.0",
-        "@sideway/address": "^4.1.3",
+        "@hapi/hoek": "^9.3.0",
+        "@hapi/topo": "^5.1.0",
+        "@sideway/address": "^4.1.4",
         "@sideway/formula": "^3.0.1",
         "@sideway/pinpoint": "^2.0.0"
-      },
-      "dependencies": {
-        "@hapi/hoek": {
-          "version": "9.2.1",
-          "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.1.tgz",
-          "integrity": "sha512-gfta+H8aziZsm8pZa0vj04KO6biEiisppNgA1kbJvFrrWu9Vm7eaUEy76DIxsuTaWvti5fkJVhllWc6ZTE+Mdw=="
-        }
       }
     },
     "jose": {

+ 1 - 1
services/docstore/package.json

@@ -28,7 +28,7 @@
     "body-parser": "^1.19.0",
     "bson": "^1.1.4",
     "bunyan": "^1.8.15",
-    "celebrate": "^13.0.4",
+    "celebrate": "^15.0.3",
     "express": "^4.18.2",
     "lodash": "^4.17.21",
     "mongodb": "^6.2.0",

+ 1 - 1
services/project-history/package.json

@@ -30,7 +30,7 @@
     "body-parser": "^1.19.0",
     "bunyan": "^1.8.15",
     "byline": "^4.2.1",
-    "celebrate": "^10.1.0",
+    "celebrate": "^15.0.3",
     "cli": "^1.0.1",
     "diff-match-patch": "overleaf/diff-match-patch#89805f9c671a77a263fc53461acd62aa7498f688",
     "esmock": "^2.1.0",

+ 1 - 1
services/real-time/app/js/Router.js

@@ -8,7 +8,7 @@ const WebsocketAddressManager = require('./WebsocketAddressManager')
 const bodyParser = require('body-parser')
 const base64id = require('base64id')
 const { UnexpectedArgumentsError } = require('./Errors')
-const Joi = require('@hapi/joi')
+const Joi = require('joi')
 
 const HOSTNAME = require('os').hostname()
 

+ 1 - 1
services/real-time/package.json

@@ -17,7 +17,6 @@
     "types:check": "tsc --noEmit"
   },
   "dependencies": {
-    "@hapi/joi": "^17.1.1",
     "@overleaf/logger": "*",
     "@overleaf/metrics": "*",
     "@overleaf/o-error": "*",
@@ -31,6 +30,7 @@
     "cookie-parser": "^1.4.5",
     "express": "^4.18.2",
     "express-session": "^1.17.1",
+    "joi": "^17.12.0",
     "proxy-addr": "^2.0.7",
     "request": "^2.88.2",
     "socket.io": "github:overleaf/socket.io#0.9.19-overleaf-10",

+ 13 - 11
services/web/app/src/infrastructure/Validation.js

@@ -2,20 +2,22 @@ const { Joi: CelebrateJoi, celebrate, errors } = require('celebrate')
 const { ObjectId } = require('mongodb')
 
 const objectIdValidator = {
-  name: 'objectId',
-  language: {
-    invalid: 'needs to be a valid ObjectId',
+  type: 'objectId',
+  base: CelebrateJoi.any(),
+  messages: {
+    'objectId.invalid': 'needs to be a valid ObjectId',
   },
-  pre(value, state, options) {
-    if (!ObjectId.isValid(value)) {
-      return this.createError('objectId.invalid', { value }, state, options)
+  coerce(value) {
+    return {
+      value: typeof value === typeof ObjectId ? value : new ObjectId(value),
     }
-
-    if (options.convert) {
-      return new ObjectId(value)
+  },
+  prepare(value, helpers) {
+    if (!ObjectId.isValid(value)) {
+      return {
+        errors: helpers.error('objectId.invalid'),
+      }
     }
-
-    return value
   },
 }
 

+ 2 - 1
services/web/package.json

@@ -93,7 +93,7 @@
     "bull": "^3.18.0",
     "bunyan": "^1.8.15",
     "cache-flow": "^1.9.0",
-    "celebrate": "^10.0.1",
+    "celebrate": "^15.0.3",
     "connect-redis": "^6.1.3",
     "content-disposition": "^0.5.0",
     "contentful": "^6.1.1",
@@ -117,6 +117,7 @@
     "i18next": "^23.5.1",
     "i18next-fs-backend": "^2.2.0",
     "i18next-http-middleware": "^3.4.1",
+    "joi": "^17.12.0",
     "jose": "^4.3.8",
     "json2csv": "^4.3.3",
     "jsonwebtoken": "^9.0.0",

+ 47 - 0
services/web/test/unit/src/infrastructure/ValidationTests.js

@@ -0,0 +1,47 @@
+const { Joi } = require('../../../../app/src/infrastructure/Validation')
+const { ObjectId } = require('mongodb')
+const { expect } = require('chai')
+const { ValidationError } = require('joi')
+
+describe('Validation', function () {
+  const validObjectId = '123456781234567812345678'
+  const invalidObjectId = '12345678-1234-1234-12345678'
+
+  it('accepts valid ObjectId strings', async function () {
+    const schema = Joi.object({
+      test: Joi.objectId(),
+    })
+
+    const value = await schema.validateAsync({
+      test: validObjectId,
+    })
+
+    expect(value.test).to.be.instanceof(ObjectId)
+    expect(value.test.toHexString()).to.equal(validObjectId)
+  })
+
+  it('rejects invalid ObjectId strings', async function () {
+    const schema = Joi.object({
+      test: Joi.objectId(),
+    })
+
+    const promise = schema.validateAsync({
+      test: invalidObjectId,
+    })
+
+    expect(promise).to.be.rejectedWith(ValidationError)
+  })
+
+  it('accepts valid ObjectId objects', async function () {
+    const schema = Joi.object({
+      test: Joi.objectId(),
+    })
+
+    const value = await schema.validateAsync({
+      test: new ObjectId(validObjectId),
+    })
+
+    expect(value.test).to.be.instanceof(ObjectId)
+    expect(value.test.toHexString()).to.equal(validObjectId)
+  })
+})