quidproquo-deploy-awscdk 0.0.183 → 0.0.185
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/commonjs/constructs/feature/webserver/webEntry/WebQpqWebserverWebEntryConstruct.js +14 -0
- package/lib/commonjs/constructs/feature/webserver/webEntry/utils/securityHeaders.js +13 -2
- package/package.json +7 -7
- package/src/constructs/feature/webserver/webEntry/WebQpqWebserverWebEntryConstruct.ts +15 -0
- package/src/constructs/feature/webserver/webEntry/utils/securityHeaders.ts +17 -2
package/lib/commonjs/constructs/feature/webserver/webEntry/WebQpqWebserverWebEntryConstruct.js
CHANGED
|
@@ -129,6 +129,20 @@ class WebQpqWebserverWebEntryConstruct extends QpqConstructBlock_1.QpqConstructB
|
|
|
129
129
|
// ],
|
|
130
130
|
// },
|
|
131
131
|
securityHeadersBehavior: (0, securityHeaders_1.convertSecurityHeadersFromQpqSecurityHeaders)(quidproquo_webserver_1.qpqWebServerUtils.getBaseDomainName(props.qpqConfig), props.webEntryConfig.securityHeaders),
|
|
132
|
+
// TODO: Expose this to config.
|
|
133
|
+
corsBehavior: {
|
|
134
|
+
accessControlAllowCredentials: false,
|
|
135
|
+
accessControlAllowHeaders: [
|
|
136
|
+
'Origin',
|
|
137
|
+
'Access-Control-Request-Headers',
|
|
138
|
+
'Access-Control-Request-Method',
|
|
139
|
+
],
|
|
140
|
+
accessControlAllowMethods: ['GET', 'HEAD', 'OPTIONS'],
|
|
141
|
+
accessControlAllowOrigins: ['*'],
|
|
142
|
+
accessControlExposeHeaders: ['*'],
|
|
143
|
+
accessControlMaxAge: cdk.Duration.seconds(600),
|
|
144
|
+
originOverride: true,
|
|
145
|
+
},
|
|
132
146
|
});
|
|
133
147
|
// Create a CloudFront distribution using the S3 bucket as the origin
|
|
134
148
|
const distributionOrigin = new aws_cdk_lib_1.aws_cloudfront_origins.S3Origin(originBucket);
|
|
@@ -67,11 +67,22 @@ const convertContentSecurityPolicy = (baseDomain, contentSecurityPolicy) => {
|
|
|
67
67
|
override: true,
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
const contentSecurityPolicyCopy = Object.assign(Object.assign({}, contentSecurityPolicy.contentSecurityPolicy), {
|
|
71
|
+
// Auto add the secure urls for s3
|
|
72
|
+
// TODO: Do a better url like the one below
|
|
73
|
+
// https://*.s3.${region}.amazonaws.com
|
|
74
|
+
// Or even better:
|
|
75
|
+
// https://${bucketName}.s3.${region}.amazonaws.com
|
|
76
|
+
// even better better could be to proxy secure links with a new web proxy and it would hide the bucket.
|
|
77
|
+
'connect-src': [
|
|
78
|
+
...(contentSecurityPolicy.contentSecurityPolicy['connect-src'] || []),
|
|
79
|
+
'https://*.amazonaws.com',
|
|
80
|
+
] });
|
|
70
81
|
return {
|
|
71
|
-
contentSecurityPolicy: Object.keys(
|
|
82
|
+
contentSecurityPolicy: Object.keys(contentSecurityPolicyCopy)
|
|
72
83
|
.map((directive) => [
|
|
73
84
|
directive,
|
|
74
|
-
...
|
|
85
|
+
...contentSecurityPolicyCopy[directive].map((cspe) => (0, exports.convertContentSecurityPolicyEntryToString)(baseDomain, cspe)),
|
|
75
86
|
].join(' '))
|
|
76
87
|
.join('; '),
|
|
77
88
|
override: contentSecurityPolicy.override,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-deploy-awscdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.185",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"types": "./lib/commonjs/index.d.ts",
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"constructs": "^10.1.208",
|
|
32
32
|
"esbuild": "^0.15.16",
|
|
33
33
|
"liquidjs": "^10.7.0",
|
|
34
|
-
"quidproquo-actionprocessor-awslambda": "0.0.
|
|
35
|
-
"quidproquo-actionprocessor-node": "0.0.
|
|
36
|
-
"quidproquo-config-aws": "0.0.
|
|
37
|
-
"quidproquo-core": "0.0.
|
|
38
|
-
"quidproquo-webserver": "0.0.
|
|
34
|
+
"quidproquo-actionprocessor-awslambda": "0.0.185",
|
|
35
|
+
"quidproquo-actionprocessor-node": "0.0.185",
|
|
36
|
+
"quidproquo-config-aws": "0.0.185",
|
|
37
|
+
"quidproquo-core": "0.0.185",
|
|
38
|
+
"quidproquo-webserver": "0.0.185"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/aws-lambda": "^8.10.109",
|
|
42
42
|
"@types/babel__traverse": "7.18.2",
|
|
43
43
|
"@types/node": "^20.2.1",
|
|
44
44
|
"@types/prettier": "2.6.0",
|
|
45
|
-
"quidproquo-tsconfig": "0.0.
|
|
45
|
+
"quidproquo-tsconfig": "0.0.185",
|
|
46
46
|
"ts-node": "^10.9.1",
|
|
47
47
|
"typescript": "^4.9.3"
|
|
48
48
|
}
|
|
@@ -161,6 +161,21 @@ export class WebQpqWebserverWebEntryConstruct extends QpqConstructBlock {
|
|
|
161
161
|
qpqWebServerUtils.getBaseDomainName(props.qpqConfig),
|
|
162
162
|
props.webEntryConfig.securityHeaders,
|
|
163
163
|
),
|
|
164
|
+
|
|
165
|
+
// TODO: Expose this to config.
|
|
166
|
+
corsBehavior: {
|
|
167
|
+
accessControlAllowCredentials: false,
|
|
168
|
+
accessControlAllowHeaders: [
|
|
169
|
+
'Origin',
|
|
170
|
+
'Access-Control-Request-Headers',
|
|
171
|
+
'Access-Control-Request-Method',
|
|
172
|
+
],
|
|
173
|
+
accessControlAllowMethods: ['GET', 'HEAD', 'OPTIONS'],
|
|
174
|
+
accessControlAllowOrigins: ['*'],
|
|
175
|
+
accessControlExposeHeaders: ['*'],
|
|
176
|
+
accessControlMaxAge: cdk.Duration.seconds(600),
|
|
177
|
+
originOverride: true,
|
|
178
|
+
},
|
|
164
179
|
});
|
|
165
180
|
|
|
166
181
|
// Create a CloudFront distribution using the S3 bucket as the origin
|
|
@@ -69,12 +69,27 @@ export const convertContentSecurityPolicy = (
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
const contentSecurityPolicyCopy: Record<string, ContentSecurityPolicyEntry[]> = {
|
|
73
|
+
...contentSecurityPolicy.contentSecurityPolicy,
|
|
74
|
+
|
|
75
|
+
// Auto add the secure urls for s3
|
|
76
|
+
// TODO: Do a better url like the one below
|
|
77
|
+
// https://*.s3.${region}.amazonaws.com
|
|
78
|
+
// Or even better:
|
|
79
|
+
// https://${bucketName}.s3.${region}.amazonaws.com
|
|
80
|
+
// even better better could be to proxy secure links with a new web proxy and it would hide the bucket.
|
|
81
|
+
'connect-src': [
|
|
82
|
+
...(contentSecurityPolicy.contentSecurityPolicy['connect-src'] || []),
|
|
83
|
+
'https://*.amazonaws.com',
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
|
|
72
87
|
return {
|
|
73
|
-
contentSecurityPolicy: Object.keys(
|
|
88
|
+
contentSecurityPolicy: Object.keys(contentSecurityPolicyCopy)
|
|
74
89
|
.map((directive) =>
|
|
75
90
|
[
|
|
76
91
|
directive,
|
|
77
|
-
...
|
|
92
|
+
...contentSecurityPolicyCopy[directive].map((cspe) =>
|
|
78
93
|
convertContentSecurityPolicyEntryToString(baseDomain, cspe),
|
|
79
94
|
),
|
|
80
95
|
].join(' '),
|