@expressots/core 2.4.0 → 2.5.0
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/lib/CHANGELOG.md +69 -54
- package/lib/cjs/middleware/interfaces/helmet.interface.js +2 -0
- package/lib/cjs/middleware/middleware-resolver.js +1 -0
- package/lib/cjs/middleware/middleware-service.js +16 -0
- package/lib/cjs/types/middleware/index.d.ts +1 -0
- package/lib/cjs/types/middleware/interfaces/helmet.interface.d.ts +210 -0
- package/lib/cjs/types/middleware/middleware-service.d.ts +16 -1
- package/lib/package.json +3 -3
- package/package.json +3 -3
package/lib/CHANGELOG.md
CHANGED
|
@@ -1,71 +1,86 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
## [2.
|
|
3
|
+
## [2.5.0](https://github.com/expressots/expressots/compare/2.4.0...2.5.0) (2023-10-04)
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
### Features
|
|
7
7
|
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* bump vite from 4.4.9 to 4.4.10 ([5be4adc](https://github.com/expressots/expressots/commit/5be4adc18d84c3affa57d248dd07801bda4dd5b9))
|
|
9
|
+
* bump vitest from 0.34.5 to 0.34.6 ([11ca77f](https://github.com/expressots/expressots/commit/11ca77f29d19d1de05b2ae2a56b9e306311621bf))
|
|
10
|
+
* **core:** add helmet middleware ([7648afb](https://github.com/expressots/expressots/commit/7648afb68054c1e69990f7d33efe35ec4d99b464)), closes [#107](https://github.com/expressots/expressots/issues/107)
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
### Bug Fixes
|
|
13
14
|
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* add
|
|
30
|
-
*
|
|
15
|
+
* adjust interface, remove duplicated helmet registry ([376c065](https://github.com/expressots/expressots/commit/376c0654d655ee8d29c0649d83ec6fb7cf860791))
|
|
16
|
+
* remove duplicate optionslhelmet interface ([93bfdea](https://github.com/expressots/expressots/commit/93bfdea0057614b0a2e449817fb095ed23112011))
|
|
17
|
+
|
|
18
|
+
## [2.4.0](https://github.com/expressots/expressots/compare/2.3.0...2.4.0) (2023-10-01)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* add interface for `express-rate-limit` ([86cf5d2](https://github.com/expressots/expressots/commit/86cf5d2d2bdbdd4acdd6f4a0597634790d99f972))
|
|
24
|
+
* implement `express-rate-limit` in service ([e31a5f4](https://github.com/expressots/expressots/commit/e31a5f47b67ac01795b6ac64e639cd53078f8048))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* add App container all tests ([d6c8212](https://github.com/expressots/expressots/commit/d6c8212ec80fe239b38e4ff592ed0be3e507cd99))
|
|
30
|
+
* add cjs as default build ([d16cfa5](https://github.com/expressots/expressots/commit/d16cfa50238c2e299fffaf079fb62847de94e7d8))
|
|
31
|
+
* add code coverage configuration ([3676e32](https://github.com/expressots/expressots/commit/3676e328833bd92ea7ebe28b567195bbd5c25bb2))
|
|
32
|
+
* adjust reporter to text, html, json ([04acb04](https://github.com/expressots/expressots/commit/04acb04c2e9229f0531ffb990f22665d94506f2c))
|
|
33
|
+
* remove adapter peer dependecy ([bad171b](https://github.com/expressots/expressots/commit/bad171be98f3b2ec58c3793836ba2000c3727dbc))
|
|
34
|
+
* resolves all current issues ([877c121](https://github.com/expressots/expressots/commit/877c1216405e35b3b90f61caf13d73b20202eac5))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Documentation
|
|
38
|
+
|
|
39
|
+
* add jsdoc to interfaces ([228d190](https://github.com/expressots/expressots/commit/228d190f7ca58c71e5bcd1f03ecf70b2e7fdbe03))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Code Refactoring
|
|
43
|
+
|
|
44
|
+
* add types to default params ([b366e14](https://github.com/expressots/expressots/commit/b366e14d2b7d9322b4ea92ae3afdfbb834e42e16))
|
|
45
|
+
* eliminate duplicate return statements ([b57fa85](https://github.com/expressots/expressots/commit/b57fa8517c5656fed71b73cc3c2b65834c8d8833))
|
|
31
46
|
* revert changes due to future features ([89fce01](https://github.com/expressots/expressots/commit/89fce01f08ebd1539471e51808040e4383c3e6f4))
|
|
32
47
|
|
|
33
|
-
## [2.3.0](https://github.com/expressots/expressots/compare/2.2.1...2.3.0) (2023-09-25)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### Features
|
|
37
|
-
|
|
38
|
-
* add morgan middleware ([ffe5f36](https://github.com/expressots/expressots/commit/ffe5f36b447f7fafd3a44c90a304b3b9c5ec4481))
|
|
39
|
-
* bump vitest from 0.34.4 to 0.34.5 ([e1a1da5](https://github.com/expressots/expressots/commit/e1a1da51ab35bf6bb24ba9073b270a490ab331d8))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### Bug Fixes
|
|
43
|
-
|
|
48
|
+
## [2.3.0](https://github.com/expressots/expressots/compare/2.2.1...2.3.0) (2023-09-25)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Features
|
|
52
|
+
|
|
53
|
+
* add morgan middleware ([ffe5f36](https://github.com/expressots/expressots/commit/ffe5f36b447f7fafd3a44c90a304b3b9c5ec4481))
|
|
54
|
+
* bump vitest from 0.34.4 to 0.34.5 ([e1a1da5](https://github.com/expressots/expressots/commit/e1a1da51ab35bf6bb24ba9073b270a490ab331d8))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Bug Fixes
|
|
58
|
+
|
|
44
59
|
* add IMorgan interface to serve it types ([adb29e5](https://github.com/expressots/expressots/commit/adb29e505af79cf998f1288085695dfee8e5680d))
|
|
45
60
|
|
|
46
|
-
## [2.2.0](https://github.com/expressots/expressots/compare/2.1.0...2.2.0) (2023-09-21)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### Features
|
|
50
|
-
|
|
51
|
-
* add middleware based routing ([3d7720e](https://github.com/expressots/expressots/commit/3d7720e21807117333d60e7f2b7bb01789b96060))
|
|
52
|
-
* add serve-favicon middleware ([024bdc4](https://github.com/expressots/expressots/commit/024bdc4d8d4f9890175975d052ca09c5b4e245cf))
|
|
53
|
-
* add serve-favicon middleware ([0733697](https://github.com/expressots/expressots/commit/0733697ed66a7133e60ec6fa09bdaeb0bf1985d7))
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
### Bug Fixes
|
|
57
|
-
|
|
58
|
-
* add chore message to pre-commit hook ([45ae428](https://github.com/expressots/expressots/commit/45ae428652bb6e4f49cb2a6334686be0dee3669d))
|
|
59
|
-
* add middleware validation based on path ([7035153](https://github.com/expressots/expressots/commit/7035153dededd3ca7c5159544f4ab79baee2c4d7))
|
|
60
|
-
* re-write cp, mv and rm improving performance ([68d68ad](https://github.com/expressots/expressots/commit/68d68ad11385ca783fa5c51e3092937a6f898ac6))
|
|
61
|
-
* update contribute_howto doc ([4bf6e12](https://github.com/expressots/expressots/commit/4bf6e121091e894a7675ff78959ab4647ec04f6d))
|
|
62
|
-
* update contribute_howto doc ([fbbe47d](https://github.com/expressots/expressots/commit/fbbe47d6df76211fadd736fab864aa41e0313ec9))
|
|
63
|
-
* update templates for v2 scaffold ([74811f3](https://github.com/expressots/expressots/commit/74811f3ac54610be7367de75f37363dc0c107dbc))
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### Build System
|
|
67
|
-
|
|
68
|
-
* **scripts:** add cross platform build scripts ([e6cecbc](https://github.com/expressots/expressots/commit/e6cecbc6b7a309f00aa6cd60f6d8207dc8d4c5cb))
|
|
61
|
+
## [2.2.0](https://github.com/expressots/expressots/compare/2.1.0...2.2.0) (2023-09-21)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Features
|
|
65
|
+
|
|
66
|
+
* add middleware based routing ([3d7720e](https://github.com/expressots/expressots/commit/3d7720e21807117333d60e7f2b7bb01789b96060))
|
|
67
|
+
* add serve-favicon middleware ([024bdc4](https://github.com/expressots/expressots/commit/024bdc4d8d4f9890175975d052ca09c5b4e245cf))
|
|
68
|
+
* add serve-favicon middleware ([0733697](https://github.com/expressots/expressots/commit/0733697ed66a7133e60ec6fa09bdaeb0bf1985d7))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Bug Fixes
|
|
72
|
+
|
|
73
|
+
* add chore message to pre-commit hook ([45ae428](https://github.com/expressots/expressots/commit/45ae428652bb6e4f49cb2a6334686be0dee3669d))
|
|
74
|
+
* add middleware validation based on path ([7035153](https://github.com/expressots/expressots/commit/7035153dededd3ca7c5159544f4ab79baee2c4d7))
|
|
75
|
+
* re-write cp, mv and rm improving performance ([68d68ad](https://github.com/expressots/expressots/commit/68d68ad11385ca783fa5c51e3092937a6f898ac6))
|
|
76
|
+
* update contribute_howto doc ([4bf6e12](https://github.com/expressots/expressots/commit/4bf6e121091e894a7675ff78959ab4647ec04f6d))
|
|
77
|
+
* update contribute_howto doc ([fbbe47d](https://github.com/expressots/expressots/commit/fbbe47d6df76211fadd736fab864aa41e0313ec9))
|
|
78
|
+
* update templates for v2 scaffold ([74811f3](https://github.com/expressots/expressots/commit/74811f3ac54610be7367de75f37363dc0c107dbc))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Build System
|
|
82
|
+
|
|
83
|
+
* **scripts:** add cross platform build scripts ([e6cecbc](https://github.com/expressots/expressots/commit/e6cecbc6b7a309f00aa6cd60f6d8207dc8d4c5cb))
|
|
69
84
|
* **scripts:** add cross platform build scripts ([8b5c133](https://github.com/expressots/expressots/commit/8b5c133e4e28d67b8a7edca5b04bfe04a6d12540))
|
|
70
85
|
|
|
71
86
|
## [2.1.0](https://github.com/expressots/expressots/compare/2.0.0...2.1.0) (2023-09-16)
|
|
@@ -161,6 +161,22 @@ let Middleware = Middleware_1 = class Middleware {
|
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Adds a middleware to enhance security by setting various HTTP headers.
|
|
166
|
+
*
|
|
167
|
+
* @param options - Optional configuration options for Helmet.
|
|
168
|
+
*
|
|
169
|
+
*/
|
|
170
|
+
addHelmet(options) {
|
|
171
|
+
const middleware = (0, middleware_resolver_1.middlewareResolver)("helmet", options);
|
|
172
|
+
const middlewareExist = this.middlewareExists("helmet");
|
|
173
|
+
if (middleware && !middlewareExist) {
|
|
174
|
+
this.middlewarePipeline.push({
|
|
175
|
+
timestamp: new Date(),
|
|
176
|
+
middleware,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
164
180
|
/**
|
|
165
181
|
* Configures the error handling middleware for the application.
|
|
166
182
|
*
|
|
@@ -3,6 +3,7 @@ export { OptionsJson } from "./interfaces/body-parser.interface";
|
|
|
3
3
|
export { CorsOptions } from "./interfaces/cors.interface";
|
|
4
4
|
export { CompressionOptions } from "./interfaces/compression.interface";
|
|
5
5
|
export { CookieSessionOptions } from "./interfaces/cookie-session/cookie-session.interface";
|
|
6
|
+
export { OptionsHelmet } from "./interfaces/helmet.interface";
|
|
6
7
|
export { Keygrip } from "./interfaces/cookie-session/keygrip.interface";
|
|
7
8
|
export { CookieParserOptions } from "./interfaces/cookie-parser.interface";
|
|
8
9
|
export { ServeFaviconOptions } from "./interfaces/serve-favicon.interface";
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { Request, Response } from "express";
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {string} cspDirectiveValue
|
|
4
|
+
* Possible values for Content Security Policy directives.
|
|
5
|
+
* Can be 'self', 'none', or a string.
|
|
6
|
+
*/
|
|
7
|
+
type cspDirectiveValue = "self" | "none" | string;
|
|
8
|
+
/**
|
|
9
|
+
* @interface directiveOptions
|
|
10
|
+
* Options for defining Content Security Policy directives.
|
|
11
|
+
*/
|
|
12
|
+
interface directiveOptions {
|
|
13
|
+
"default-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
14
|
+
"base-uri"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
15
|
+
"font-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
16
|
+
"form-action"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
17
|
+
"frame-ancestors"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
18
|
+
"img-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
19
|
+
"object-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
20
|
+
"script-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
21
|
+
"script-src-attr"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
22
|
+
"style-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
23
|
+
"upgrade-insecure-requests"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @interface ContentSecurityPolicy
|
|
27
|
+
* Defines a Content Security Policy configuration.
|
|
28
|
+
*/
|
|
29
|
+
interface ContentSecurityPolicy {
|
|
30
|
+
/**
|
|
31
|
+
* A function that sets Content Security Policy.
|
|
32
|
+
*
|
|
33
|
+
* @param {directiveOptions} options - Optional configuration options for Content Security Policy.
|
|
34
|
+
* @returns {Function} A middleware function.
|
|
35
|
+
*/
|
|
36
|
+
useDefaults?: false;
|
|
37
|
+
directives?: directiveOptions;
|
|
38
|
+
reportOnly?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {Object} CrossOriginEmbedderPolicyOptions
|
|
42
|
+
* An optional policy for Cross-Origin Embedder Policy.
|
|
43
|
+
*/
|
|
44
|
+
interface CrossOriginEmbedderPolicyOptions {
|
|
45
|
+
/**
|
|
46
|
+
* An optional policy for Cross-Origin Embedder Policy.
|
|
47
|
+
*/
|
|
48
|
+
policy?: "require-corp" | "credentialless";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {Object} CrossOriginOpenerPolicyOptions
|
|
52
|
+
* An optional policy for Cross-Origin Opener Policy.
|
|
53
|
+
*/
|
|
54
|
+
interface CrossOriginOpenerPolicyOptions {
|
|
55
|
+
/**
|
|
56
|
+
* An optional policy for Cross-Origin Opener Policy.
|
|
57
|
+
*/
|
|
58
|
+
policy?: "same-origin" | "same-origin-allow-popups" | "unsafe-none";
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {Object} CrossOriginResourcePolicyOptions
|
|
62
|
+
* An optional policy for Cross-Origin Resource Policy.
|
|
63
|
+
*/
|
|
64
|
+
interface CrossOriginResourcePolicyOptions {
|
|
65
|
+
/**
|
|
66
|
+
* An optional policy for Cross-Origin Resource Policy.
|
|
67
|
+
*/
|
|
68
|
+
policy?: "same-origin" | "same-site" | "cross-origin";
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @typedef {string} ReferrerPolicyToken
|
|
72
|
+
* A type alias for Referrer Policy tokens.
|
|
73
|
+
*/
|
|
74
|
+
type ReferrerPolicyToken = "no-referrer" | "no-referrer-when-downgrade" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | "";
|
|
75
|
+
/**
|
|
76
|
+
* @typedef {Object} ReferrerPolicyOptions
|
|
77
|
+
* An optional policy for Referrer Policy.
|
|
78
|
+
*/
|
|
79
|
+
interface ReferrerPolicyOptions {
|
|
80
|
+
/**
|
|
81
|
+
* An optional policy for Referrer Policy.
|
|
82
|
+
*/
|
|
83
|
+
policy?: ReferrerPolicyToken | Array<ReferrerPolicyToken> | false;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @typedef {Object} StrictTransportSecurityOptions
|
|
87
|
+
* Options for Strict Transport Security.
|
|
88
|
+
*/
|
|
89
|
+
interface StrictTransportSecurityOptions {
|
|
90
|
+
/**
|
|
91
|
+
* An optional max age for Strict Transport Security.
|
|
92
|
+
*/
|
|
93
|
+
maxAge?: number;
|
|
94
|
+
/**
|
|
95
|
+
* An optional flag to include subdomains.
|
|
96
|
+
*/
|
|
97
|
+
includeSubDomains?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* An optional flag for preload.
|
|
100
|
+
*/
|
|
101
|
+
preload?: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @typedef {boolean|string} xContentTypeOptions
|
|
105
|
+
* Options for X-Content-Type-Options.
|
|
106
|
+
*/
|
|
107
|
+
type xContentTypeOptions = false | "nosniff";
|
|
108
|
+
/**
|
|
109
|
+
* @typedef {Object} XDnsPrefetchControlOptions
|
|
110
|
+
* Options for X-DNS-Prefetch-Control.
|
|
111
|
+
*/
|
|
112
|
+
interface XDnsPrefetchControlOptions {
|
|
113
|
+
/**
|
|
114
|
+
* An optional flag to allow DNS prefetching.
|
|
115
|
+
*/
|
|
116
|
+
allow?: boolean;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @typedef {Object} XFrameOptionsOptions
|
|
120
|
+
* Options for X-Frame-Options.
|
|
121
|
+
*/
|
|
122
|
+
interface XFrameOptionsOptions {
|
|
123
|
+
/**
|
|
124
|
+
* An optional action for X-Frame-Options.
|
|
125
|
+
*/
|
|
126
|
+
action?: "deny" | "sameorigin" | false;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @typedef {Object} XPermittedCrossDomainPoliciesOptions
|
|
130
|
+
* Options for X-Permitted-Cross-Domain-Policies.
|
|
131
|
+
*/
|
|
132
|
+
interface XPermittedCrossDomainPoliciesOptions {
|
|
133
|
+
/**
|
|
134
|
+
* An optional policy for X-Permitted-Cross-Domain-Policies.
|
|
135
|
+
*/
|
|
136
|
+
permittedPolicies?: "none" | "master-only" | "by-content-type" | "all";
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @typedef {boolean} xPoweredByOptions
|
|
140
|
+
* Options for X-Powered-By.
|
|
141
|
+
*/
|
|
142
|
+
type xPoweredByOptions = false;
|
|
143
|
+
/**
|
|
144
|
+
* @typedef {boolean} xXssProtectionOptions
|
|
145
|
+
* Options for X-XSS-Protection.
|
|
146
|
+
*/
|
|
147
|
+
type xXssProtectionOptions = false;
|
|
148
|
+
/**
|
|
149
|
+
* @interface OptionsHelmet
|
|
150
|
+
* Options for Helmet middleware.
|
|
151
|
+
*/
|
|
152
|
+
export interface OptionsHelmet {
|
|
153
|
+
/**
|
|
154
|
+
* An optional Content Security Policy.
|
|
155
|
+
*/
|
|
156
|
+
contentSecurityPolicy?: ContentSecurityPolicy | false;
|
|
157
|
+
/**
|
|
158
|
+
* An optional Cross-Origin Embedder Policy.
|
|
159
|
+
*/
|
|
160
|
+
crossOriginEmbedderPolicy?: CrossOriginEmbedderPolicyOptions | boolean;
|
|
161
|
+
/**
|
|
162
|
+
* An optional Cross-Origin Opener Policy.
|
|
163
|
+
*/
|
|
164
|
+
crossOriginOpenerPolicy?: boolean | CrossOriginOpenerPolicyOptions;
|
|
165
|
+
/**
|
|
166
|
+
* An optional Cross-Origin Resource Policy.
|
|
167
|
+
*/
|
|
168
|
+
crossOriginResourcePolicy?: boolean | CrossOriginResourcePolicyOptions;
|
|
169
|
+
/**
|
|
170
|
+
* An optional flag for originAgentCluster.
|
|
171
|
+
*/
|
|
172
|
+
originAgentCluster?: false;
|
|
173
|
+
/**
|
|
174
|
+
* An optional Referrer Policy.
|
|
175
|
+
*/
|
|
176
|
+
referrerPolicy?: ReferrerPolicyOptions;
|
|
177
|
+
/**
|
|
178
|
+
* An optional Strict Transport Security.
|
|
179
|
+
*/
|
|
180
|
+
strictTransportSecurity?: StrictTransportSecurityOptions;
|
|
181
|
+
/**
|
|
182
|
+
* An optional X-Content-Type-Options.
|
|
183
|
+
*/
|
|
184
|
+
xContentTypeOptions?: xContentTypeOptions;
|
|
185
|
+
/**
|
|
186
|
+
* An optional X-DNS-Prefetch-Control.
|
|
187
|
+
*/
|
|
188
|
+
xDnsPrefetchControl?: XDnsPrefetchControlOptions;
|
|
189
|
+
/**
|
|
190
|
+
* An optional X-Download-Options.
|
|
191
|
+
*/
|
|
192
|
+
xDownloadOptions?: boolean | "noopen";
|
|
193
|
+
/**
|
|
194
|
+
* An optional X-Frame-Options.
|
|
195
|
+
*/
|
|
196
|
+
xFrameOptions?: XFrameOptionsOptions;
|
|
197
|
+
/**
|
|
198
|
+
* An optional X-Permitted-Cross-Domain-Policies.
|
|
199
|
+
*/
|
|
200
|
+
xPermittedCrossDomainPolicies?: XPermittedCrossDomainPoliciesOptions;
|
|
201
|
+
/**
|
|
202
|
+
* An optional X-Powered-By.
|
|
203
|
+
*/
|
|
204
|
+
xPoweredBy?: xPoweredByOptions;
|
|
205
|
+
/**
|
|
206
|
+
* An optional X-XSS-Protection.
|
|
207
|
+
*/
|
|
208
|
+
xXssProtection?: xXssProtectionOptions;
|
|
209
|
+
}
|
|
210
|
+
export {};
|
|
@@ -9,6 +9,7 @@ import { CookieSessionOptions } from "./interfaces/cookie-session/cookie-session
|
|
|
9
9
|
import { ServeFaviconOptions } from "./interfaces/serve-favicon.interface";
|
|
10
10
|
import { FormatFn, OptionsMorgan } from "./interfaces/morgan.interface";
|
|
11
11
|
import { RateLimitOptions } from "./interfaces/express-rate-limit.interface";
|
|
12
|
+
import { OptionsHelmet } from "./interfaces/helmet.interface";
|
|
12
13
|
/**
|
|
13
14
|
* ExpressHandler Type
|
|
14
15
|
*
|
|
@@ -58,7 +59,7 @@ interface IMiddleware {
|
|
|
58
59
|
* Adds a Rate Limit middleware to the middleware collection.
|
|
59
60
|
* The rate limiter is responsible for adding dynamic rate limit and request throttling to the application.
|
|
60
61
|
*
|
|
61
|
-
* @param options - Optional configuration options for the
|
|
62
|
+
* @param options - Optional configuration options for the rate limiter.
|
|
62
63
|
*/
|
|
63
64
|
addRateLimiter(options?: RateLimitOptions): void;
|
|
64
65
|
/**
|
|
@@ -141,6 +142,13 @@ interface IMiddleware {
|
|
|
141
142
|
* @returns The error handler middleware.
|
|
142
143
|
*/
|
|
143
144
|
getErrorHandler(): ExpressHandler;
|
|
145
|
+
/**
|
|
146
|
+
* Adds Helmet middleware to enhance security by setting various HTTP headers.
|
|
147
|
+
*
|
|
148
|
+
* @param options - Optional configuration options for Helmet.
|
|
149
|
+
* @returns The configuration options for Helmet middleware.
|
|
150
|
+
*/
|
|
151
|
+
addHelmet(options?: OptionsHelmet): void;
|
|
144
152
|
}
|
|
145
153
|
/**
|
|
146
154
|
* Singleton class that implements the IConfigure interface.
|
|
@@ -208,6 +216,13 @@ declare class Middleware implements IMiddleware {
|
|
|
208
216
|
* @param options - Optional configuration options for serving the favicon. Defines the behavior of the favicon middleware like cache control, custom headers, etc.
|
|
209
217
|
*/
|
|
210
218
|
addServeFavicon(path: string | Buffer, options?: ServeFaviconOptions): void;
|
|
219
|
+
/**
|
|
220
|
+
* Adds a middleware to enhance security by setting various HTTP headers.
|
|
221
|
+
*
|
|
222
|
+
* @param options - Optional configuration options for Helmet.
|
|
223
|
+
*
|
|
224
|
+
*/
|
|
225
|
+
addHelmet(options?: OptionsHelmet): void;
|
|
211
226
|
/**
|
|
212
227
|
* Configures the error handling middleware for the application.
|
|
213
228
|
*
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
|
|
5
5
|
"author": "Richard Zampieri",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"release-it": "^16.1.5",
|
|
89
89
|
"ts-jest": "^29.0.5",
|
|
90
90
|
"typescript": "^5.0.3",
|
|
91
|
-
"vite": "4.4.
|
|
92
|
-
"vitest": "0.34.
|
|
91
|
+
"vite": "4.4.10",
|
|
92
|
+
"vitest": "0.34.6"
|
|
93
93
|
},
|
|
94
94
|
"release-it": {
|
|
95
95
|
"git": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expressots/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Expressots - modern, fast, lightweight nodejs web framework (@core)",
|
|
5
5
|
"author": "Richard Zampieri",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"release-it": "^16.1.5",
|
|
89
89
|
"ts-jest": "^29.0.5",
|
|
90
90
|
"typescript": "^5.0.3",
|
|
91
|
-
"vite": "4.4.
|
|
92
|
-
"vitest": "0.34.
|
|
91
|
+
"vite": "4.4.10",
|
|
92
|
+
"vitest": "0.34.6"
|
|
93
93
|
},
|
|
94
94
|
"release-it": {
|
|
95
95
|
"git": {
|