@riocrypto/common-server 1.0.1911 → 1.0.1913

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>> | undefined>;
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())) {
@@ -75,12 +75,17 @@ class LoggerService {
75
75
  });
76
76
  this.requestMethodFilter = (0, winston_1.format)((info) => {
77
77
  const allowedMethods = ["POST", "PATCH", "DELETE"];
78
- if (info.meta &&
79
- info.meta.req &&
80
- allowedMethods.includes(info.meta.req.method)) {
81
- return info;
78
+ // Only apply filter if req.method is defined
79
+ if (info.meta && info.meta.req && info.meta.req.method) {
80
+ if (allowedMethods.includes(info.meta.req.method)) {
81
+ return info;
82
+ }
83
+ else {
84
+ return false; // Filter out logs for other methods
85
+ }
82
86
  }
83
- return false; // Filter out logs for other methods
87
+ // If there's no req.method, don't filter out the log
88
+ return info;
84
89
  });
85
90
  this.logger = null;
86
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1911",
3
+ "version": "1.0.1913",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",