@devmoods/express-extras 0.52.2 → 0.52.3
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/csrf.d.ts +3 -3
- package/dist/csrf.js +5 -5
- package/package.json +10 -10
package/dist/csrf.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { type RequestHandler, type Request, type Response } from 'express';
|
|
2
2
|
export declare const getCsrfSecret: () => string;
|
|
3
3
|
export interface CsrfMiddlewareOptions {
|
|
4
|
-
|
|
4
|
+
exempt?: boolean;
|
|
5
5
|
cookieName?: string;
|
|
6
6
|
sessionIdentifier?: (req: Request) => string;
|
|
7
7
|
}
|
|
8
8
|
interface CsrfOptions {
|
|
9
|
-
|
|
9
|
+
exempt: boolean;
|
|
10
10
|
cookieName: string;
|
|
11
11
|
sessionIdentifier: string;
|
|
12
12
|
}
|
|
13
|
-
export declare function csrf({
|
|
13
|
+
export declare function csrf({ exempt, sessionIdentifier, cookieName, }?: CsrfMiddlewareOptions): RequestHandler;
|
|
14
14
|
export declare function setCsrfOptions(options: CsrfOptions): void;
|
|
15
15
|
interface TokenOptions {
|
|
16
16
|
overwrite?: boolean;
|
package/dist/csrf.js
CHANGED
|
@@ -16,7 +16,7 @@ export const getCsrfSecret = () => {
|
|
|
16
16
|
}
|
|
17
17
|
return secret;
|
|
18
18
|
};
|
|
19
|
-
export function csrf({
|
|
19
|
+
export function csrf({ exempt = false, sessionIdentifier, cookieName, } = {}) {
|
|
20
20
|
return (req, res, next) => {
|
|
21
21
|
const existingOptions = useCsrfOptions();
|
|
22
22
|
setCsrfOptions({
|
|
@@ -24,7 +24,7 @@ export function csrf({ excempt = false, sessionIdentifier, cookieName, } = {}) {
|
|
|
24
24
|
sessionIdentifier: sessionIdentifier
|
|
25
25
|
? sessionIdentifier(req)
|
|
26
26
|
: existingOptions.sessionIdentifier,
|
|
27
|
-
|
|
27
|
+
exempt,
|
|
28
28
|
});
|
|
29
29
|
next();
|
|
30
30
|
};
|
|
@@ -35,7 +35,7 @@ export function setCsrfOptions(options) {
|
|
|
35
35
|
}
|
|
36
36
|
function useCsrfOptions() {
|
|
37
37
|
return (useContext(CSRF_CONTEXT_KEY) || {
|
|
38
|
-
|
|
38
|
+
exempt: true,
|
|
39
39
|
cookieName: defaultCookieName(),
|
|
40
40
|
sessionIdentifier: '',
|
|
41
41
|
});
|
|
@@ -109,8 +109,8 @@ const validateRequest = (req) => {
|
|
|
109
109
|
};
|
|
110
110
|
export function doubleCsrfProtection(req) {
|
|
111
111
|
return async () => {
|
|
112
|
-
const {
|
|
113
|
-
if (
|
|
112
|
+
const { exempt } = useCsrfOptions();
|
|
113
|
+
if (exempt) {
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
if (ignoredMethods.has(req.method)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devmoods/express-extras",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.3",
|
|
4
4
|
"description": "Kubernetes-ready utilities for rapid Node.js application development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -46,27 +46,27 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@devmoods/eslint-config": "^2.6.0",
|
|
48
48
|
"@types/koa-compose": "^3.2.8",
|
|
49
|
-
"@types/node": "22.13.
|
|
49
|
+
"@types/node": "22.13.4",
|
|
50
50
|
"@types/supertest": "^6.0.2",
|
|
51
51
|
"@vitejs/plugin-react": "^4.3.4",
|
|
52
|
-
"@vitest/coverage-v8": "^3.0.
|
|
52
|
+
"@vitest/coverage-v8": "^3.0.5",
|
|
53
53
|
"arktype": "^2.0.4",
|
|
54
54
|
"cookiejar": "^2.1.4",
|
|
55
|
-
"eslint": "^9.
|
|
55
|
+
"eslint": "^9.20.1",
|
|
56
56
|
"faktory-worker": "^4.6.0",
|
|
57
|
-
"prettier": "3.
|
|
57
|
+
"prettier": "3.5.1",
|
|
58
58
|
"supertest": "7.0.0",
|
|
59
59
|
"ts-node": "10.9.2",
|
|
60
60
|
"tsx": "^4.19.2",
|
|
61
61
|
"typescript": "5.7.3",
|
|
62
|
-
"vite": "^6.0
|
|
63
|
-
"vitest": "^3.0.
|
|
62
|
+
"vite": "^6.1.0",
|
|
63
|
+
"vitest": "^3.0.5",
|
|
64
64
|
"vitest-fail-on-console": "^0.7.1"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@devmoods/fetch": "^4.0.1",
|
|
68
|
-
"@sentry/node": "^
|
|
69
|
-
"@sentry/profiling-node": "^
|
|
68
|
+
"@sentry/node": "^9.1.0",
|
|
69
|
+
"@sentry/profiling-node": "^9.1.0",
|
|
70
70
|
"@types/bcrypt": "^5.0.2",
|
|
71
71
|
"@types/cookie-parser": "^1.4.8",
|
|
72
72
|
"@types/express": "^5.0.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"helmet": "^8.0.0",
|
|
88
88
|
"jsonwebtoken": "^9.0.2",
|
|
89
89
|
"nodemailer": "^6.10.0",
|
|
90
|
-
"pg": "^8.13.
|
|
90
|
+
"pg": "^8.13.3",
|
|
91
91
|
"redis": "^4.7.0",
|
|
92
92
|
"sonda": "^0.7.1",
|
|
93
93
|
"sql-formatter": "^15.4.10",
|