@riocrypto/common-server 1.0.1905 → 1.0.1906

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.
@@ -26,7 +26,10 @@ const verifyCsrfToken = (req, res, next) => __awaiter(void 0, void 0, void 0, fu
26
26
  // Only apply CSRF check if accessToken or adminAccessToken cookies are present
27
27
  if (hasAccessToken &&
28
28
  ["POST", "PUT", "PATCH", "DELETE"].includes(req.method.toUpperCase())) {
29
- const csrfToken = req.body.csrfToken;
29
+ // Retrieve CSRF token from the header
30
+ const csrfToken = Array.isArray(req.headers["X-CSRF-TOKEN"])
31
+ ? req.headers["X-CSRF-TOKEN"][0]
32
+ : req.headers["X-CSRF-TOKEN"];
30
33
  if (!csrfToken) {
31
34
  return res.status(403).json({ error: "CSRF token missing" });
32
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1905",
3
+ "version": "1.0.1906",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",