@riocrypto/common-server 1.0.1911 → 1.0.1912
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Request, Response, NextFunction } from "express";
|
|
2
|
-
export declare const verifyCsrfToken: (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any
|
|
2
|
+
export declare const verifyCsrfToken: (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
@@ -19,6 +19,10 @@ const common_1 = require("@riocrypto/common");
|
|
|
19
19
|
const verifyCsrfToken = (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
20
|
// Check for the presence of accessToken or adminAccessToken cookies
|
|
21
21
|
const hasAccessToken = req.cookies.accessToken || req.cookies.adminAccessToken;
|
|
22
|
+
// Skip CSRF check if the request path contains "notification"
|
|
23
|
+
if (req.path.toLowerCase().includes("notification")) {
|
|
24
|
+
return next();
|
|
25
|
+
}
|
|
22
26
|
// Only apply CSRF check if accessToken or adminAccessToken cookies are present
|
|
23
27
|
if (hasAccessToken &&
|
|
24
28
|
["POST", "PUT", "PATCH", "DELETE"].includes(req.method.toUpperCase())) {
|