koa-helmet 7.1.0 → 8.0.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/README.md +3 -3
- package/koa-helmet.d.ts +12 -79
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@ koa-helmet is a wrapper for [helmet](https://github.com/helmetjs/helmet) to work
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
npm i koa-helmet
|
|
11
|
+
npm i koa-helmet helmet
|
|
12
12
|
|
|
13
13
|
# or:
|
|
14
14
|
|
|
15
|
-
yarn add koa-helmet
|
|
15
|
+
yarn add koa-helmet helmet
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
@@ -39,7 +39,7 @@ app.use(helmet.referrerPolicy());
|
|
|
39
39
|
app.use(helmet.xssFilter());
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
You can see more in [the documentation](https://helmetjs.github.io
|
|
42
|
+
You can see more in [the documentation](https://helmetjs.github.io).
|
|
43
43
|
|
|
44
44
|
## Example
|
|
45
45
|
|
package/koa-helmet.d.ts
CHANGED
|
@@ -1,87 +1,20 @@
|
|
|
1
|
-
// Type definitions for koa-helmet
|
|
1
|
+
// Type definitions for koa-helmet 8.0
|
|
2
2
|
// Project: https://github.com/venables/koa-helmet#readme
|
|
3
3
|
// Definitions by: Nick Simmons <https://github.com/nsimmons>
|
|
4
4
|
// Jan Dolezel <https://github.com/dolezel>
|
|
5
|
-
//
|
|
5
|
+
// Julien Wajsberg <https://github.com/julienw>
|
|
6
6
|
// TypeScript Version: 2.3
|
|
7
7
|
|
|
8
|
-
import helmet from "helmet";
|
|
9
|
-
import { Middleware
|
|
8
|
+
import type { default as helmet, HelmetOptions } from "helmet";
|
|
9
|
+
import { Middleware } from "koa";
|
|
10
10
|
|
|
11
|
-
type
|
|
11
|
+
type Helmet = typeof helmet;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
type KoaHelmet = {
|
|
14
|
+
[HelmetMiddleware in keyof Helmet]: (
|
|
15
|
+
...options: Parameters<Helmet[HelmetMiddleware]>
|
|
16
|
+
) => Middleware;
|
|
17
|
+
} & ((options?: HelmetOptions) => Middleware);
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| KoaHelmetContentSecurityPolicyDirectiveFunction;
|
|
22
|
-
|
|
23
|
-
interface KoaHelmetContentSecurityPolicyDirectives {
|
|
24
|
-
baseUri?: KoaHelmetCspDirectiveValue[];
|
|
25
|
-
childSrc?: KoaHelmetCspDirectiveValue[];
|
|
26
|
-
connectSrc?: KoaHelmetCspDirectiveValue[];
|
|
27
|
-
defaultSrc?: KoaHelmetCspDirectiveValue[];
|
|
28
|
-
fontSrc?: KoaHelmetCspDirectiveValue[];
|
|
29
|
-
formAction?: KoaHelmetCspDirectiveValue[];
|
|
30
|
-
frameAncestors?: KoaHelmetCspDirectiveValue[];
|
|
31
|
-
frameSrc?: KoaHelmetCspDirectiveValue[];
|
|
32
|
-
imgSrc?: KoaHelmetCspDirectiveValue[];
|
|
33
|
-
mediaSrc?: KoaHelmetCspDirectiveValue[];
|
|
34
|
-
objectSrc?: KoaHelmetCspDirectiveValue[];
|
|
35
|
-
pluginTypes?: KoaHelmetCspDirectiveValue[];
|
|
36
|
-
prefetchSrc?: KoaHelmetCspDirectiveValue[];
|
|
37
|
-
reportTo?: string;
|
|
38
|
-
reportUri?: string;
|
|
39
|
-
sandbox?: KoaHelmetCspDirectiveValue[];
|
|
40
|
-
scriptSrc?: KoaHelmetCspDirectiveValue[];
|
|
41
|
-
scriptSrcAttr?: KoaHelmetCspDirectiveValue[];
|
|
42
|
-
scriptSrcElem?: KoaHelmetCspDirectiveValue[];
|
|
43
|
-
styleSrc?: KoaHelmetCspDirectiveValue[];
|
|
44
|
-
styleSrcAttr?: KoaHelmetCspDirectiveValue[];
|
|
45
|
-
styleSrcElem?: KoaHelmetCspDirectiveValue[];
|
|
46
|
-
workerSrc?: KoaHelmetCspDirectiveValue[];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface KoaHelmetContentSecurityPolicyConfiguration {
|
|
50
|
-
reportOnly?: boolean;
|
|
51
|
-
useDefaults?: boolean;
|
|
52
|
-
directives?: KoaHelmetContentSecurityPolicyDirectives;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface KoaHelmet {
|
|
56
|
-
(options?: HelmetOptions): Middleware;
|
|
57
|
-
contentSecurityPolicy(
|
|
58
|
-
options?: KoaHelmetContentSecurityPolicyConfiguration,
|
|
59
|
-
): Middleware;
|
|
60
|
-
crossOriginEmbedderPolicy(
|
|
61
|
-
options?: HelmetOptions["crossOriginEmbedderPolicy"],
|
|
62
|
-
): Middleware;
|
|
63
|
-
crossOriginOpenerPolicy(
|
|
64
|
-
options?: HelmetOptions["crossOriginOpenerPolicy"],
|
|
65
|
-
): Middleware;
|
|
66
|
-
crossOriginResourcePolicy(
|
|
67
|
-
options?: HelmetOptions["crossOriginResourcePolicy"],
|
|
68
|
-
): Middleware;
|
|
69
|
-
dnsPrefetchControl(
|
|
70
|
-
options?: HelmetOptions["dnsPrefetchControl"],
|
|
71
|
-
): Middleware;
|
|
72
|
-
expectCt(options?: HelmetOptions["expectCt"]): Middleware;
|
|
73
|
-
frameguard(options?: HelmetOptions["frameguard"]): Middleware;
|
|
74
|
-
hidePoweredBy(options?: HelmetOptions["hidePoweredBy"]): Middleware;
|
|
75
|
-
hsts(options?: HelmetOptions["hsts"]): Middleware;
|
|
76
|
-
ieNoOpen(options?: HelmetOptions["ieNoOpen"]): Middleware;
|
|
77
|
-
noSniff(options?: HelmetOptions["noSniff"]): Middleware;
|
|
78
|
-
permittedCrossDomainPolicies(
|
|
79
|
-
options?: HelmetOptions["permittedCrossDomainPolicies"],
|
|
80
|
-
): Middleware;
|
|
81
|
-
referrerPolicy(options?: HelmetOptions["referrerPolicy"]): Middleware;
|
|
82
|
-
xssFilter(options?: HelmetOptions["xssFilter"]): Middleware;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
declare const koaHelmet: koaHelmet.KoaHelmet;
|
|
87
|
-
export = koaHelmet;
|
|
19
|
+
declare const koaHelmet: KoaHelmet;
|
|
20
|
+
export default koaHelmet;
|
package/package.json
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
"author": "Matt Venables <matt@venabl.es>",
|
|
4
4
|
"description": "Security header middleware collection for koa",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "8.0.1",
|
|
7
7
|
"main": "lib/koa-helmet.js",
|
|
8
8
|
"typings": "./koa-helmet.d.ts",
|
|
9
9
|
"scripts": {
|
|
10
|
-
"check": "npm run format:check && npm run lint && npm run test",
|
|
10
|
+
"check": "npm run format:check && npm run lint && npm run test && npm run typecheck",
|
|
11
11
|
"format": "prettier --write .",
|
|
12
12
|
"format:check": "prettier --check .",
|
|
13
13
|
"lint": "eslint .",
|
|
14
|
-
"test": "vitest"
|
|
14
|
+
"test": "vitest",
|
|
15
|
+
"typecheck": "tsc --noEmit --pretty"
|
|
15
16
|
},
|
|
16
17
|
"keywords": [
|
|
17
18
|
"security",
|