@eggjs/security 5.0.0-beta.18 → 5.0.0-beta.19
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.
|
@@ -218,8 +218,8 @@ declare const SecurityConfig: z.ZodObject<{
|
|
|
218
218
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
219
219
|
cookieDomain?: string | ((args_0: Context, ...args: unknown[]) => string) | undefined;
|
|
220
220
|
}, {
|
|
221
|
-
type?: "ctoken" | "referer" | "all" | "any" | undefined;
|
|
222
221
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
222
|
+
type?: "ctoken" | "referer" | "all" | "any" | undefined;
|
|
223
223
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
224
224
|
enable?: boolean | undefined;
|
|
225
225
|
ignoreJSON?: boolean | undefined;
|
|
@@ -288,8 +288,8 @@ declare const SecurityConfig: z.ZodObject<{
|
|
|
288
288
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
289
289
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
290
290
|
}, {
|
|
291
|
-
value?: string | undefined;
|
|
292
291
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
292
|
+
value?: string | undefined;
|
|
293
293
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
294
294
|
enable?: boolean | undefined;
|
|
295
295
|
}>>;
|
|
@@ -407,8 +407,8 @@ declare const SecurityConfig: z.ZodObject<{
|
|
|
407
407
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
408
408
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
409
409
|
}, {
|
|
410
|
-
value?: string | undefined;
|
|
411
410
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
411
|
+
value?: string | undefined;
|
|
412
412
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
413
413
|
enable?: boolean | undefined;
|
|
414
414
|
}>>;
|
|
@@ -471,8 +471,8 @@ declare const SecurityConfig: z.ZodObject<{
|
|
|
471
471
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
472
472
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
473
473
|
}, {
|
|
474
|
-
value?: string | undefined;
|
|
475
474
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
475
|
+
value?: string | undefined;
|
|
476
476
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
477
477
|
enable?: boolean | undefined;
|
|
478
478
|
}>>;
|
|
@@ -642,6 +642,7 @@ declare const SecurityConfig: z.ZodObject<{
|
|
|
642
642
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
643
643
|
__protocolWhiteListSet?: ReadonlySet<string> | undefined;
|
|
644
644
|
}, {
|
|
645
|
+
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
645
646
|
csrf?: unknown;
|
|
646
647
|
hsts?: {
|
|
647
648
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
@@ -674,14 +675,14 @@ declare const SecurityConfig: z.ZodObject<{
|
|
|
674
675
|
supportIE?: boolean | undefined;
|
|
675
676
|
} | undefined;
|
|
676
677
|
xssProtection?: {
|
|
677
|
-
value?: string | undefined;
|
|
678
678
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
679
|
+
value?: string | undefined;
|
|
679
680
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
680
681
|
enable?: boolean | undefined;
|
|
681
682
|
} | undefined;
|
|
682
683
|
xframe?: {
|
|
683
|
-
value?: string | undefined;
|
|
684
684
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
685
|
+
value?: string | undefined;
|
|
685
686
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
686
687
|
enable?: boolean | undefined;
|
|
687
688
|
} | undefined;
|
|
@@ -693,11 +694,10 @@ declare const SecurityConfig: z.ZodObject<{
|
|
|
693
694
|
domainWhiteList?: string[] | undefined;
|
|
694
695
|
protocolWhiteList?: string[] | undefined;
|
|
695
696
|
defaultMiddleware?: string | ("csrf" | "hsts" | "methodnoallow" | "noopen" | "nosniff" | "csp" | "xssProtection" | "xframe" | "dta")[] | undefined;
|
|
696
|
-
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
697
697
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
698
698
|
referrerPolicy?: {
|
|
699
|
-
value?: string | undefined;
|
|
700
699
|
match?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
700
|
+
value?: string | undefined;
|
|
701
701
|
ignore?: string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean) | (string | RegExp | ((args_0: Context, ...args: unknown[]) => boolean))[] | undefined;
|
|
702
702
|
enable?: boolean | undefined;
|
|
703
703
|
} | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SSRFCheckAddressFunction } from "../../config/config.default.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as egg10 from "egg";
|
|
3
3
|
import { EggApplicationCore } from "egg";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/extend/safe_curl.d.ts
|
|
@@ -15,6 +15,6 @@ type HttpClientResponse<T = any> = Awaited<ReturnType<HttpClient['prototype']['r
|
|
|
15
15
|
/**
|
|
16
16
|
* safe curl with ssrf protection
|
|
17
17
|
*/
|
|
18
|
-
declare function safeCurlForApplication<T = any>(app: EggApplicationCore, url: HttpClientRequestURL, options?: HttpClientOptions): Promise<
|
|
18
|
+
declare function safeCurlForApplication<T = any>(app: EggApplicationCore, url: HttpClientRequestURL, options?: HttpClientOptions): Promise<egg10.HttpClientResponse<T>>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { HttpClientOptions, HttpClientRequestURL, HttpClientResponse, safeCurlForApplication };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { SecurityConfig } from "../../config/config.default.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as egg0 from "egg";
|
|
3
3
|
|
|
4
4
|
//#region src/lib/middlewares/index.d.ts
|
|
5
5
|
declare const _default: {
|
|
6
|
-
csp: (options: SecurityConfig["csp"]) =>
|
|
7
|
-
csrf: (options: SecurityConfig["csrf"]) =>
|
|
8
|
-
dta: () =>
|
|
9
|
-
hsts: (options: SecurityConfig["hsts"]) =>
|
|
10
|
-
methodnoallow: () =>
|
|
11
|
-
noopen: (options: SecurityConfig["noopen"]) =>
|
|
12
|
-
nosniff: (options: SecurityConfig["nosniff"]) =>
|
|
13
|
-
referrerPolicy: (options: SecurityConfig["referrerPolicy"]) =>
|
|
14
|
-
xframe: (options: SecurityConfig["xframe"]) =>
|
|
15
|
-
xssProtection: (options: SecurityConfig["xssProtection"]) =>
|
|
6
|
+
csp: (options: SecurityConfig["csp"]) => egg0.MiddlewareFunc;
|
|
7
|
+
csrf: (options: SecurityConfig["csrf"]) => egg0.MiddlewareFunc;
|
|
8
|
+
dta: () => egg0.MiddlewareFunc;
|
|
9
|
+
hsts: (options: SecurityConfig["hsts"]) => egg0.MiddlewareFunc;
|
|
10
|
+
methodnoallow: () => egg0.MiddlewareFunc;
|
|
11
|
+
noopen: (options: SecurityConfig["noopen"]) => egg0.MiddlewareFunc;
|
|
12
|
+
nosniff: (options: SecurityConfig["nosniff"]) => egg0.MiddlewareFunc;
|
|
13
|
+
referrerPolicy: (options: SecurityConfig["referrerPolicy"]) => egg0.MiddlewareFunc;
|
|
14
|
+
xframe: (options: SecurityConfig["xframe"]) => egg0.MiddlewareFunc;
|
|
15
|
+
xssProtection: (options: SecurityConfig["xssProtection"]) => egg0.MiddlewareFunc;
|
|
16
16
|
};
|
|
17
17
|
//#endregion
|
|
18
18
|
export { _default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/security",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -84,25 +84,25 @@
|
|
|
84
84
|
"zod": "^3.24.1"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"egg": "4.1.0-beta.
|
|
87
|
+
"egg": "4.1.0-beta.19"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@types/escape-html": "^1.0.4",
|
|
91
91
|
"@types/extend": "^3.0.4",
|
|
92
92
|
"@types/koa-compose": "^3.2.8",
|
|
93
93
|
"@types/mocha": "^10.0.10",
|
|
94
|
-
"@types/node": "24.
|
|
94
|
+
"@types/node": "^24.6.2",
|
|
95
95
|
"@types/type-is": "^1.6.6",
|
|
96
96
|
"beautify-benchmark": "^0.2.4",
|
|
97
97
|
"benchmark": "^2.1.4",
|
|
98
98
|
"egg-view-nunjucks": "^2.3.0",
|
|
99
99
|
"spy": "^1.0.0",
|
|
100
100
|
"tsdown": "^0.15.4",
|
|
101
|
-
"typescript": "5.9.
|
|
102
|
-
"vitest": "4.0.0-beta.
|
|
103
|
-
"@eggjs/mock": "7.0.0-beta.
|
|
104
|
-
"@eggjs/supertest": "9.0.0-beta.
|
|
105
|
-
"@eggjs/tsconfig": "3.1.0-beta.
|
|
101
|
+
"typescript": "^5.9.3",
|
|
102
|
+
"vitest": "4.0.0-beta.16",
|
|
103
|
+
"@eggjs/mock": "7.0.0-beta.19",
|
|
104
|
+
"@eggjs/supertest": "9.0.0-beta.19",
|
|
105
|
+
"@eggjs/tsconfig": "3.1.0-beta.19"
|
|
106
106
|
},
|
|
107
107
|
"files": [
|
|
108
108
|
"dist"
|