@adobe/helix-html-pipeline 3.4.5 → 3.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/CHANGELOG.md +14 -0
- package/package.json +4 -4
- package/src/forms-pipe.js +1 -1
- package/src/utils/auth.js +12 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.5.0](https://github.com/adobe/helix-html-pipeline/compare/v3.4.6...v3.5.0) (2022-10-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* respect x-forwarded-proto in auth ([#171](https://github.com/adobe/helix-html-pipeline/issues/171)) ([cae61e1](https://github.com/adobe/helix-html-pipeline/commit/cae61e15f16903bc298c4dd5a4a6f7b1379e5ae5))
|
|
7
|
+
|
|
8
|
+
## [3.4.6](https://github.com/adobe/helix-html-pipeline/compare/v3.4.5...v3.4.6) (2022-10-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* trim spaces after comma ([#166](https://github.com/adobe/helix-html-pipeline/issues/166)) ([24a1542](https://github.com/adobe/helix-html-pipeline/commit/24a1542468451f1648891e164e7075ad7c35e7fc))
|
|
14
|
+
|
|
1
15
|
## [3.4.5](https://github.com/adobe/helix-html-pipeline/compare/v3.4.4...v3.4.5) (2022-10-17)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"hast-util-to-html": "8.0.3",
|
|
49
49
|
"hast-util-to-string": "2.0.0",
|
|
50
50
|
"hastscript": "7.1.0",
|
|
51
|
-
"jose": "4.10.
|
|
51
|
+
"jose": "4.10.3",
|
|
52
52
|
"mdast-util-gfm-footnote": "1.0.1",
|
|
53
53
|
"mdast-util-gfm-strikethrough": "1.0.1",
|
|
54
54
|
"mdast-util-gfm-table": "1.0.6",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@semantic-release/git": "10.0.1",
|
|
82
82
|
"@semantic-release/npm": "9.0.1",
|
|
83
83
|
"c8": "7.12.0",
|
|
84
|
-
"eslint": "8.
|
|
84
|
+
"eslint": "8.26.0",
|
|
85
85
|
"eslint-import-resolver-exports": "1.0.0-beta.3",
|
|
86
86
|
"eslint-plugin-header": "3.1.1",
|
|
87
87
|
"eslint-plugin-import": "2.26.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"jsdom": "20.0.1",
|
|
92
92
|
"junit-report-builder": "3.0.1",
|
|
93
93
|
"lint-staged": "13.0.3",
|
|
94
|
-
"mocha": "10.
|
|
94
|
+
"mocha": "10.1.0",
|
|
95
95
|
"mocha-multi-reporters": "1.5.1",
|
|
96
96
|
"remark-gfm": "3.0.1",
|
|
97
97
|
"semantic-release": "19.0.5"
|
package/src/forms-pipe.js
CHANGED
|
@@ -134,7 +134,7 @@ export async function formsPipe(state, request) {
|
|
|
134
134
|
|
|
135
135
|
const sourceLocation = resourceFetchResponse.headers.get('x-amz-meta-x-source-location');
|
|
136
136
|
const referer = request.headers.get('referer') || 'unknown';
|
|
137
|
-
const sheetNames = sheets.split(',');
|
|
137
|
+
const sheetNames = sheets.split(',').map((s) => s.trim());
|
|
138
138
|
|
|
139
139
|
if (!sourceLocation || !sheetNames.includes('incoming')) {
|
|
140
140
|
return error(log, `Target workbook at ${resourcePath} is not setup to intake data.`, 403, response);
|
package/src/utils/auth.js
CHANGED
|
@@ -79,9 +79,9 @@ export async function decodeIdToken(state, idp, idToken, lenient = false) {
|
|
|
79
79
|
*
|
|
80
80
|
* @param {PipelineState} state
|
|
81
81
|
* @param {PipelineRequest} req
|
|
82
|
-
* @
|
|
82
|
+
* @returns {{proto: (*|string), host: string}} the request host and protocol.
|
|
83
83
|
*/
|
|
84
|
-
function
|
|
84
|
+
function getRequestHostAndProto(state, req) {
|
|
85
85
|
// determine the location of 'this' document based on the xfh header. so that logins to
|
|
86
86
|
// .page stay on .page. etc. but fallback to the config.host if non set
|
|
87
87
|
let host = req.headers.get('x-forwarded-host');
|
|
@@ -91,8 +91,12 @@ function getRequestHost(state, req) {
|
|
|
91
91
|
if (!host) {
|
|
92
92
|
host = state.config.host;
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
const proto = req.headers.get('x-forwarded-proto') || 'https';
|
|
95
|
+
state.log.info(`request host is: ${host} (${proto})`);
|
|
96
|
+
return {
|
|
97
|
+
host,
|
|
98
|
+
proto,
|
|
99
|
+
};
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
/**
|
|
@@ -181,7 +185,7 @@ export class AuthInfo {
|
|
|
181
185
|
|
|
182
186
|
// determine the location of 'this' document based on the xfh header. so that logins to
|
|
183
187
|
// .page stay on .page. etc. but fallback to the config.host if non set
|
|
184
|
-
const host =
|
|
188
|
+
const { host, proto } = getRequestHostAndProto(state, req);
|
|
185
189
|
if (!host) {
|
|
186
190
|
log.error('[auth] unable to create login redirect: no xfh or config.host.');
|
|
187
191
|
res.status = 401;
|
|
@@ -199,6 +203,7 @@ export class AuthInfo {
|
|
|
199
203
|
// this is our own login redirect, i.e. the current document
|
|
200
204
|
requestPath: state.info.path,
|
|
201
205
|
requestHost: host,
|
|
206
|
+
requestProto: proto,
|
|
202
207
|
}).encode();
|
|
203
208
|
|
|
204
209
|
url.searchParams.append('client_id', clientId);
|
|
@@ -239,9 +244,9 @@ export class AuthInfo {
|
|
|
239
244
|
|
|
240
245
|
// ensure that the request is made to the target host
|
|
241
246
|
if (req.params.state?.requestHost) {
|
|
242
|
-
const host =
|
|
247
|
+
const { host } = getRequestHostAndProto(state, req);
|
|
243
248
|
if (host !== req.params.state.requestHost) {
|
|
244
|
-
const url = new URL(
|
|
249
|
+
const url = new URL(`${req.params.state.requestProto}://${req.params.state.requestHost}/.auth`);
|
|
245
250
|
url.searchParams.append('state', req.params.rawState);
|
|
246
251
|
url.searchParams.append('code', req.params.code);
|
|
247
252
|
const location = state.createExternalLocation(url.href);
|