@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.js
CHANGED
|
@@ -3131,7 +3131,7 @@ var CsrfMiddleware = class {
|
|
|
3131
3131
|
const isStateChanging = ["POST", "PUT", "DELETE", "PATCH"].includes(method);
|
|
3132
3132
|
if (isStateChanging) {
|
|
3133
3133
|
const policy = this._getRouteMatcher().checkRoutePolicy(req.path, method);
|
|
3134
|
-
if (Guards47.isDefined(policy.withCsrf) && policy.withCsrf) return await next();
|
|
3134
|
+
if (Guards47.isDefined(policy.withCsrf) && !policy.withCsrf) return await next();
|
|
3135
3135
|
const { network, tracing, identity } = this._requestContext.getContext() ?? {};
|
|
3136
3136
|
const headerToken = network?.csrf;
|
|
3137
3137
|
const cookieToken = network?.csrfCookie;
|
|
@@ -3634,11 +3634,32 @@ var MiddlewareModule = class {
|
|
|
3634
3634
|
}
|
|
3635
3635
|
_buildOptionsMiddleware(opts, requestContext, allowMethod, withCredentials, routePolicyCheck) {
|
|
3636
3636
|
if (Guards53.isDefined(opts.cors?.enablePreflight) && opts.cors?.enablePreflight) {
|
|
3637
|
+
const allowHeaders = Array.from(
|
|
3638
|
+
/* @__PURE__ */ new Set([
|
|
3639
|
+
"x-csrf-token",
|
|
3640
|
+
"Authorization",
|
|
3641
|
+
"Content-Type",
|
|
3642
|
+
"X-Requested-With",
|
|
3643
|
+
"Accept",
|
|
3644
|
+
"Origin",
|
|
3645
|
+
"referer",
|
|
3646
|
+
"x-correlation-id",
|
|
3647
|
+
"x-request-id",
|
|
3648
|
+
"x-span-id",
|
|
3649
|
+
"x-parent-span-id",
|
|
3650
|
+
"x-return-address",
|
|
3651
|
+
"x-sequence-id",
|
|
3652
|
+
"x-sequence-position",
|
|
3653
|
+
"x-sequence-size",
|
|
3654
|
+
"x-expiration",
|
|
3655
|
+
...opts.cors.allowHeaders ?? []
|
|
3656
|
+
])
|
|
3657
|
+
);
|
|
3637
3658
|
return new OptionsMiddleware(
|
|
3638
3659
|
requestContext,
|
|
3639
3660
|
allowMethod(),
|
|
3640
3661
|
routePolicyCheck,
|
|
3641
|
-
|
|
3662
|
+
allowHeaders,
|
|
3642
3663
|
withCredentials
|
|
3643
3664
|
);
|
|
3644
3665
|
}
|