@riocrypto/common-server 1.0.1905 → 1.0.1907
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
|
-
|
|
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
|
}
|