@middy/http-security-headers 7.2.2 → 7.3.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/index.d.ts +4 -0
- package/index.js +31 -1
- package/package.json +3 -6
package/index.d.ts
CHANGED
|
@@ -58,4 +58,8 @@ declare function httpSecurityHeaders(
|
|
|
58
58
|
options?: WithBoolValues<Options>,
|
|
59
59
|
): middy.MiddlewareObj<unknown, unknown, Error>;
|
|
60
60
|
|
|
61
|
+
export declare function httpSecurityHeadersValidateOptions(
|
|
62
|
+
options?: Record<string, unknown>,
|
|
63
|
+
): void;
|
|
64
|
+
|
|
61
65
|
export default httpSecurityHeaders;
|
package/index.js
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
// Copyright 2017 - 2026 will Farrell, Luciano Mammino, and Middy contributors.
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import { normalizeHttpResponse } from "@middy/util";
|
|
3
|
+
import { normalizeHttpResponse, validateOptions } from "@middy/util";
|
|
4
|
+
|
|
5
|
+
// Each policy option accepts either a config object or a boolean (true = use
|
|
6
|
+
// defaults, false = disable). See middleware body for enable/disable logic.
|
|
7
|
+
const objectOrBoolean = (v) =>
|
|
8
|
+
typeof v === "boolean" ||
|
|
9
|
+
(v !== null && typeof v === "object" && !Array.isArray(v));
|
|
10
|
+
|
|
11
|
+
const optionSchema = {
|
|
12
|
+
contentSecurityPolicy: objectOrBoolean,
|
|
13
|
+
contentSecurityPolicyReportOnly: "boolean?",
|
|
14
|
+
contentTypeOptions: objectOrBoolean,
|
|
15
|
+
crossOriginEmbedderPolicy: objectOrBoolean,
|
|
16
|
+
crossOriginOpenerPolicy: objectOrBoolean,
|
|
17
|
+
crossOriginResourcePolicy: objectOrBoolean,
|
|
18
|
+
dnsPrefetchControl: objectOrBoolean,
|
|
19
|
+
downloadOptions: objectOrBoolean,
|
|
20
|
+
frameOptions: objectOrBoolean,
|
|
21
|
+
originAgentCluster: objectOrBoolean,
|
|
22
|
+
permissionsPolicy: objectOrBoolean,
|
|
23
|
+
permittedCrossDomainPolicies: objectOrBoolean,
|
|
24
|
+
poweredBy: "boolean?",
|
|
25
|
+
referrerPolicy: objectOrBoolean,
|
|
26
|
+
reportingEndpoints: objectOrBoolean,
|
|
27
|
+
reportTo: objectOrBoolean,
|
|
28
|
+
strictTransportSecurity: objectOrBoolean,
|
|
29
|
+
xssProtection: objectOrBoolean,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const httpSecurityHeadersValidateOptions = (options) =>
|
|
33
|
+
validateOptions("@middy/http-security-headers", optionSchema, options);
|
|
4
34
|
|
|
5
35
|
// Code and Defaults heavily based off https://helmetjs.github.io/
|
|
6
36
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/http-security-headers",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "Applies best practice security headers to responses. It's a simplified port of HelmetJS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
"import": {
|
|
18
18
|
"types": "./index.d.ts",
|
|
19
19
|
"default": "./index.js"
|
|
20
|
-
},
|
|
21
|
-
"require": {
|
|
22
|
-
"default": "./index.js"
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
},
|
|
@@ -68,10 +65,10 @@
|
|
|
68
65
|
"url": "https://github.com/sponsors/willfarrell"
|
|
69
66
|
},
|
|
70
67
|
"dependencies": {
|
|
71
|
-
"@middy/util": "7.
|
|
68
|
+
"@middy/util": "7.3.0"
|
|
72
69
|
},
|
|
73
70
|
"devDependencies": {
|
|
74
|
-
"@middy/core": "7.
|
|
71
|
+
"@middy/core": "7.3.0",
|
|
75
72
|
"@types/aws-lambda": "^8.0.0",
|
|
76
73
|
"@types/node": "^22.0.0"
|
|
77
74
|
}
|