@xeno-js/core 4.0.0 → 4.1.1
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.
- package/dist/index.cjs +23 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3155,7 +3155,7 @@ var CsrfMiddleware = class {
|
|
|
3155
3155
|
const isStateChanging = ["POST", "PUT", "DELETE", "PATCH"].includes(method);
|
|
3156
3156
|
if (isStateChanging) {
|
|
3157
3157
|
const policy = this._getRouteMatcher().checkRoutePolicy(req.path, method);
|
|
3158
|
-
if (import_shared85.Guards.isDefined(policy.withCsrf) && policy.withCsrf) return await next();
|
|
3158
|
+
if (import_shared85.Guards.isDefined(policy.withCsrf) && !policy.withCsrf) return await next();
|
|
3159
3159
|
const { network, tracing, identity } = this._requestContext.getContext() ?? {};
|
|
3160
3160
|
const headerToken = network?.csrf;
|
|
3161
3161
|
const cookieToken = network?.csrfCookie;
|
|
@@ -3644,11 +3644,32 @@ var MiddlewareModule = class {
|
|
|
3644
3644
|
}
|
|
3645
3645
|
_buildOptionsMiddleware(opts, requestContext, allowMethod, withCredentials, routePolicyCheck) {
|
|
3646
3646
|
if (import_shared92.Guards.isDefined(opts.cors?.enablePreflight) && opts.cors?.enablePreflight) {
|
|
3647
|
+
const allowHeaders = Array.from(
|
|
3648
|
+
/* @__PURE__ */ new Set([
|
|
3649
|
+
"x-csrf-token",
|
|
3650
|
+
"Authorization",
|
|
3651
|
+
"Content-Type",
|
|
3652
|
+
"X-Requested-With",
|
|
3653
|
+
"Accept",
|
|
3654
|
+
"Origin",
|
|
3655
|
+
"referer",
|
|
3656
|
+
"x-correlation-id",
|
|
3657
|
+
"x-request-id",
|
|
3658
|
+
"x-span-id",
|
|
3659
|
+
"x-parent-span-id",
|
|
3660
|
+
"x-return-address",
|
|
3661
|
+
"x-sequence-id",
|
|
3662
|
+
"x-sequence-position",
|
|
3663
|
+
"x-sequence-size",
|
|
3664
|
+
"x-expiration",
|
|
3665
|
+
...opts.cors.allowHeaders ?? []
|
|
3666
|
+
])
|
|
3667
|
+
);
|
|
3647
3668
|
return new OptionsMiddleware(
|
|
3648
3669
|
requestContext,
|
|
3649
3670
|
allowMethod(),
|
|
3650
3671
|
routePolicyCheck,
|
|
3651
|
-
|
|
3672
|
+
allowHeaders,
|
|
3652
3673
|
withCredentials
|
|
3653
3674
|
);
|
|
3654
3675
|
}
|