@agnostack/next-shopify 1.13.4-beta.46 → 1.13.4-beta.48
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
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.13.4-beta.48](https://github.com/agnostack/next-shopify/compare/v1.13.4-beta.47...v1.13.4-beta.48) (2023-11-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* wip ([3315169](https://github.com/agnostack/next-shopify/commit/3315169925362a70daa7d6c4f4897f67b00f1519))
|
|
7
|
+
|
|
8
|
+
## [1.13.4-beta.47](https://github.com/agnostack/next-shopify/compare/v1.13.4-beta.46...v1.13.4-beta.47) (2023-11-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* wip ([dcbe873](https://github.com/agnostack/next-shopify/commit/dcbe87388d805f2ceafd16df7f3f527e8d28056c))
|
|
14
|
+
|
|
1
15
|
## [1.13.4-beta.46](https://github.com/agnostack/next-shopify/compare/v1.13.4-beta.45...v1.13.4-beta.46) (2023-11-28)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../src/lib/handlers/api/proxy.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../src/lib/handlers/api/proxy.js"],"names":[],"mappings":"AAsCO,sHA+ON"}
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6
6
|
const nextjs_cors_1 = tslib_1.__importDefault(require("nextjs-cors"));
|
|
7
7
|
const http_proxy_1 = tslib_1.__importDefault(require("http-proxy"));
|
|
8
|
+
const raw_body_1 = tslib_1.__importDefault(require("raw-body"));
|
|
8
9
|
const node_http_proxy_json_1 = tslib_1.__importDefault(require("node-http-proxy-json"));
|
|
9
10
|
const utils_1 = require("../../utils");
|
|
10
11
|
const shared_1 = require("../../../shared");
|
|
@@ -16,45 +17,77 @@ const verifyAppProxySignature = (signature, verifiable, hmacSecret) => {
|
|
|
16
17
|
const handleProxy = (serverRuntimeConfig, config) => (req, res, params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
18
|
var _a, _b;
|
|
18
19
|
const { generateReplacements } = config !== null && config !== void 0 ? config : {};
|
|
19
|
-
const { API_PATHS, APP_CONFIG, APP_BASE_URL, TARGET_SAFELIST, ORIGIN_SAFELIST, } = serverRuntimeConfig;
|
|
20
|
-
const _c = (_a = req.headers) !== null && _a !== void 0 ? _a : {}, { origin,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'x-extension-session': sessionToken, 'x-extension-point': extensionPoint, 'x-shop-domain': shopDomainHeader, 'x-shopify-shop-domain': shopifyShopDomainHeader, 'x-shopify-shop': shopHeader = shopifyShopDomainHeader !== null && shopifyShopDomainHeader !== void 0 ? shopifyShopDomainHeader : shopDomainHeader, 'x-shopify-app-id': shopifyAppId, 'x-app-id': appId = shopifyAppId,
|
|
20
|
+
const { keyPairs, API_PATHS, APP_CONFIG, APP_BASE_URL, TARGET_SAFELIST, ORIGIN_SAFELIST, } = serverRuntimeConfig;
|
|
21
|
+
const _c = (_a = req.headers) !== null && _a !== void 0 ? _a : {}, { origin, authorization, // THIS
|
|
22
|
+
'x-public-key': apiKey, // THIS
|
|
23
|
+
'x-ephemeral-key': ephemeralPublicKey, // THIS
|
|
24
|
+
'x-authorization-timestamp': authTimestamp, // THIS
|
|
25
|
+
'x-forwarded-for': _forwardFor, 'x-forwarded-proto': _forwardProto, 'x-forwarded-host': forwardHost, 'x-proxy-origin': proxyOrigin } = _c, _headers = tslib_1.__rest(_c, ["origin", "authorization", 'x-public-key', 'x-ephemeral-key', 'x-authorization-timestamp', 'x-forwarded-for', 'x-forwarded-proto', 'x-forwarded-host', 'x-proxy-origin']);
|
|
26
|
+
const { 'x-extension-session': sessionToken, 'x-extension-point': extensionPoint, 'x-shop-domain': shopDomainHeader, 'x-shopify-shop-domain': shopifyShopDomainHeader, 'x-shopify-shop': shopHeader = shopifyShopDomainHeader !== null && shopifyShopDomainHeader !== void 0 ? shopifyShopDomainHeader : shopDomainHeader, 'x-shopify-app-id': shopifyAppId, 'x-app-id': appId = shopifyAppId,
|
|
27
27
|
// 'x-shopify-app-installation-id': shopifyAppInstallationId,
|
|
28
28
|
// 'x-app-installation-id': appInstallationId = shopifyAppInstallationId, // TODO: pass along installationId??
|
|
29
29
|
// TODO: pass along providerSetId??
|
|
30
30
|
} = _headers;
|
|
31
|
-
|
|
32
|
-
if ((0, shared_1.stringEmpty)(origin)) {
|
|
33
|
-
req.headers = Object.assign(Object.assign({}, req.headers), { origin: proxyOrigin || forwardHost });
|
|
34
|
-
}
|
|
35
|
-
const _d = (_b = req.query) !== null && _b !== void 0 ? _b : {}, { signature, proxyEncoded } = _d, verifiable = tslib_1.__rest(_d, ["signature", "proxyEncoded"]);
|
|
36
|
-
const { shop: _shop, host, timestamp, path_prefix } = verifiable;
|
|
37
|
-
const shop = _shop || shopHeader;
|
|
38
|
-
yield (0, nextjs_cors_1.default)(req, res, {
|
|
39
|
-
methods: ['PUT', 'PATCH', 'POST', 'DELETE'],
|
|
40
|
-
origin: (origin, callback) => {
|
|
41
|
-
const isSafelisted = (0, shared_1.matchHostname)(origin, [
|
|
42
|
-
...ORIGIN_SAFELIST,
|
|
43
|
-
'cdn.shopify.com' // NOTE: this is the domain for checkout UI extensions
|
|
44
|
-
]);
|
|
45
|
-
if (isSafelisted) {
|
|
46
|
-
return callback(null, true);
|
|
47
|
-
}
|
|
48
|
-
return callback(new Error('Invalid CORS origin'));
|
|
49
|
-
},
|
|
50
|
-
optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
|
|
51
|
-
});
|
|
52
|
-
const { target: targetParam } = params !== null && params !== void 0 ? params : {};
|
|
53
|
-
const _targetUrl = ((0, shared_1.stringEmpty)(targetParam) || targetParam.startsWith('http')) ? targetParam : `${APP_BASE_URL}/${(0, shared_1.removeLeadingSlash)(targetParam)}`;
|
|
54
|
-
const { origin: target, hostname, pathname, search } = (0, shared_1.stringNotEmpty)(_targetUrl) ? new URL(_targetUrl) : {};
|
|
55
|
-
let targetPath = [pathname, search].filter(shared_1.stringNotEmpty).join('');
|
|
56
|
-
let headers;
|
|
31
|
+
let targetPath;
|
|
57
32
|
try {
|
|
33
|
+
const [authProtocol, authSignature] = (0, shared_1.ensureString)(authorization).split(' ');
|
|
34
|
+
const isVerifiable = (apiKey && ephemeralPublicKey && (keyPairs === null || keyPairs === void 0 ? void 0 : keyPairs.shared) && authTimestamp && authSignature && (authProtocol === 'HMAC-SHA256'));
|
|
35
|
+
let verificationKeys;
|
|
36
|
+
// NOTE raw request body is required for shopify's validation
|
|
37
|
+
const _rawBody = yield (0, raw_body_1.default)(req);
|
|
38
|
+
const rawBody = _rawBody.toString();
|
|
39
|
+
const parsedBody = JSON.parse(rawBody || '{}'); // NOTE: parsedody should be encrypted when isVerifiable
|
|
40
|
+
console.log(`>>> > handleProxy > parsedBody:`, parsedBody);
|
|
41
|
+
let decryptedBody = parsedBody;
|
|
42
|
+
// TEMP!!! remove isVerifiable check once webwidget moved to react
|
|
43
|
+
if (isVerifiable) {
|
|
44
|
+
if (!apiKey || !ephemeralPublicKey || !(keyPairs === null || keyPairs === void 0 ? void 0 : keyPairs.shared) || !authTimestamp || !authSignature || (authProtocol !== 'HMAC-SHA256')) {
|
|
45
|
+
return res.status(401).json({ message: 'Invalid or missing authorization' });
|
|
46
|
+
}
|
|
47
|
+
verificationKeys = yield shared_1.subtle.getVerificationKeys({
|
|
48
|
+
publicKey: ephemeralPublicKey,
|
|
49
|
+
privateKey: keyPairs.shared.privateKey,
|
|
50
|
+
});
|
|
51
|
+
if (!verificationKeys) {
|
|
52
|
+
return res.status(412).json({ message: 'Invalid or missing verification' });
|
|
53
|
+
}
|
|
54
|
+
const verificationPayload = (0, shared_1.objectToSortedString)(Object.assign({ method: (0, shared_1.getRequestMethod)(parsedBody, req.method), timestamp: authTimestamp, body: parsedBody }, (0, shared_1.normalizeURIParts)(req.url)));
|
|
55
|
+
const isValid = yield shared_1.subtle.verifyHMAC(verificationPayload, verificationKeys.derivedHMACKey, authSignature);
|
|
56
|
+
if (!isValid) {
|
|
57
|
+
return res.status(412).json({ message: 'Invalid or missing verification' });
|
|
58
|
+
}
|
|
59
|
+
if (parsedBody) {
|
|
60
|
+
const decryptedMessage = yield shared_1.subtle.decryptMessage(parsedBody, verificationKeys.derivedSecretKey);
|
|
61
|
+
decryptedBody = JSON.parse(decryptedMessage !== null && decryptedMessage !== void 0 ? decryptedMessage : '{}');
|
|
62
|
+
console.log(`>>> > handleProxy > decryptedBody:`, decryptedBody);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// NOTE: GET requests are not always sending along origin
|
|
66
|
+
if ((0, shared_1.stringEmpty)(origin)) {
|
|
67
|
+
req.headers = Object.assign(Object.assign({}, req.headers), { origin: proxyOrigin || forwardHost });
|
|
68
|
+
}
|
|
69
|
+
const _d = (_b = req.query) !== null && _b !== void 0 ? _b : {}, { signature, proxyEncoded } = _d, verifiable = tslib_1.__rest(_d, ["signature", "proxyEncoded"]);
|
|
70
|
+
const { shop: _shop, host, timestamp, path_prefix } = verifiable;
|
|
71
|
+
const shop = _shop || shopHeader;
|
|
72
|
+
yield (0, nextjs_cors_1.default)(req, res, {
|
|
73
|
+
methods: ['PUT', 'PATCH', 'POST', 'DELETE'],
|
|
74
|
+
origin: (origin, callback) => {
|
|
75
|
+
const isSafelisted = (0, shared_1.matchHostname)(origin, [
|
|
76
|
+
...ORIGIN_SAFELIST,
|
|
77
|
+
'cdn.shopify.com' // NOTE: this is the domain for checkout UI extensions
|
|
78
|
+
]);
|
|
79
|
+
if (isSafelisted) {
|
|
80
|
+
return callback(null, true);
|
|
81
|
+
}
|
|
82
|
+
return callback(new Error('Invalid CORS origin'));
|
|
83
|
+
},
|
|
84
|
+
optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
|
|
85
|
+
});
|
|
86
|
+
const { target: targetParam } = params !== null && params !== void 0 ? params : {};
|
|
87
|
+
// eslint-disable-next-line max-len
|
|
88
|
+
const _targetUrl = ((0, shared_1.stringEmpty)(targetParam) || targetParam.startsWith('http')) ? targetParam : `${APP_BASE_URL}/${(0, shared_1.removeLeadingSlash)(targetParam)}`;
|
|
89
|
+
const { origin: target, hostname, pathname, search } = (0, shared_1.stringNotEmpty)(_targetUrl) ? new URL(_targetUrl) : {};
|
|
90
|
+
targetPath = [pathname, search].filter(shared_1.stringNotEmpty).join('');
|
|
58
91
|
const safelistedTarget = (0, shared_1.matchHostname)(hostname, Object.assign({ [new URL(APP_BASE_URL).hostname]: {
|
|
59
92
|
// HMMM: can we generate our own session token so as to not have to tell handleGraph/Rest to behave as offline?
|
|
60
93
|
// headers: {
|
|
@@ -77,6 +110,7 @@ const handleProxy = (serverRuntimeConfig, config) => (req, res, params) => tslib
|
|
|
77
110
|
: path_prefix);
|
|
78
111
|
console.log(`>>> > handleProxy > isShopifyOriginOrRelative:`, {
|
|
79
112
|
path_prefix,
|
|
113
|
+
hostname,
|
|
80
114
|
targetParam,
|
|
81
115
|
targetPath,
|
|
82
116
|
isShopifyOriginOrRelative,
|
|
@@ -102,82 +136,50 @@ const handleProxy = (serverRuntimeConfig, config) => (req, res, params) => tslib
|
|
|
102
136
|
targetPath = (0, shared_1.appendQuery)(targetPath, new URLSearchParams(targetParams).toString());
|
|
103
137
|
}
|
|
104
138
|
const _prepareHeaders = (0, utils_1.prepareHeaders)(serverRuntimeConfig);
|
|
105
|
-
headers = yield _prepareHeaders({
|
|
139
|
+
const headers = yield _prepareHeaders({
|
|
106
140
|
generateReplacements,
|
|
107
141
|
shop,
|
|
108
142
|
appId,
|
|
109
143
|
headers: Object.assign(Object.assign({}, _headers), targetHeaders),
|
|
110
144
|
});
|
|
145
|
+
const proxy = http_proxy_1.default.createProxy();
|
|
146
|
+
return new Promise((resolve, reject) => {
|
|
147
|
+
req.url = targetPath;
|
|
148
|
+
req.body = decryptedBody;
|
|
149
|
+
if (headers) {
|
|
150
|
+
req.headers = headers;
|
|
151
|
+
}
|
|
152
|
+
proxy.on('proxyRes', function (proxyRes, proxyResRequest, proxyResResponse) {
|
|
153
|
+
(0, node_http_proxy_json_1.default)(proxyResResponse, proxyRes, function (proxyResBody) {
|
|
154
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
console.log(`>>> > proxy.on > proxyRes > proxyResBody:`, proxyResBody);
|
|
156
|
+
if (!proxyResBody || !isVerifiable || !verificationKeys) {
|
|
157
|
+
return proxyResBody;
|
|
158
|
+
}
|
|
159
|
+
const recrypted = yield shared_1.subtle.encryptMessage(JSON.stringify(proxyResBody), verificationKeys.derivedSecretKey);
|
|
160
|
+
console.log(`>>> > proxy.on > proxyRes > recrypted:`, recrypted);
|
|
161
|
+
return recrypted;
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
proxy.once('error', (error) => {
|
|
166
|
+
console.error('Proxy error', error);
|
|
167
|
+
reject(error);
|
|
168
|
+
});
|
|
169
|
+
proxy.web(req, res, {
|
|
170
|
+
target,
|
|
171
|
+
timeout: PROXY_TIMEOUT,
|
|
172
|
+
proxyTimeout: PROXY_TIMEOUT,
|
|
173
|
+
followRedirects: false,
|
|
174
|
+
changeOrigin: true,
|
|
175
|
+
secure: true,
|
|
176
|
+
});
|
|
177
|
+
});
|
|
111
178
|
}
|
|
112
179
|
catch (error) {
|
|
113
180
|
console.error(`Error handling proxy request for '${targetPath}'`, error);
|
|
114
181
|
return res.status(200).json({ message: (error === null || error === void 0 ? void 0 : error.message) || 'Error handling proxy request', targetPath });
|
|
115
182
|
}
|
|
116
|
-
const proxy = http_proxy_1.default.createProxy();
|
|
117
|
-
return new Promise((resolve, reject) => {
|
|
118
|
-
req.url = targetPath;
|
|
119
|
-
if (headers) {
|
|
120
|
-
req.headers = headers;
|
|
121
|
-
}
|
|
122
|
-
// proxy.once('error', reject)
|
|
123
|
-
proxy.on('proxyReq', (proxyReq, req, res, options) => {
|
|
124
|
-
console.log(`>>> > proxy.on > proxyReq:`, req);
|
|
125
|
-
// Modify the request body before sending it to the target
|
|
126
|
-
if (req.body) {
|
|
127
|
-
console.log(`>>> > proxy.on > proxyReq > req.body:`, req.body);
|
|
128
|
-
// proxyReq.setHeader('content-length', Buffer.byteLength(req.body))
|
|
129
|
-
// proxyReq.write(req.body)
|
|
130
|
-
// proxyReq.end()
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
proxy.on('proxyRes', function (proxyRes, req, res) {
|
|
134
|
-
(0, node_http_proxy_json_1.default)(res, proxyRes, function (body) {
|
|
135
|
-
console.log(`>>> > body:`, body);
|
|
136
|
-
// if (body) {
|
|
137
|
-
// // modify some information
|
|
138
|
-
// body.age = 2
|
|
139
|
-
// delete body.version
|
|
140
|
-
// }
|
|
141
|
-
return body; // return value can be a promise
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
// proxy.on('proxyRes', (proxyRes, req, res) => {
|
|
145
|
-
// const chunks = []
|
|
146
|
-
// proxyRes.on('data', (chunk) => {
|
|
147
|
-
// chunks.push(chunk)
|
|
148
|
-
// })
|
|
149
|
-
// proxyRes.on('end', () => {
|
|
150
|
-
// // TODO: handle encrypt/decrypy only if !isShopifyOriginOrRelative??
|
|
151
|
-
// const fpp = Buffer.concat(chunks)
|
|
152
|
-
// console.log(`>>> > proxyRes.on > fpp:`, fpp)
|
|
153
|
-
// const responseBody = fpp.toString()
|
|
154
|
-
// console.log(`>>> > proxyRes.on > responseBody:`, responseBody)
|
|
155
|
-
// const modifiedResponseBody = responseBody
|
|
156
|
-
// console.log(`>>> > proxyRes.on > modifiedResponseBody:`, modifiedResponseBody)
|
|
157
|
-
// // if (!res.headersSent) {
|
|
158
|
-
// // res.writeHead(200, {
|
|
159
|
-
// // 'Content-Length': Buffer.byteLength(fpp),
|
|
160
|
-
// // // Add any other headers you need here
|
|
161
|
-
// // })
|
|
162
|
-
// // }
|
|
163
|
-
// res.end(modifiedResponseBody)
|
|
164
|
-
// resolve()
|
|
165
|
-
// })
|
|
166
|
-
// })
|
|
167
|
-
proxy.once('error', (err) => {
|
|
168
|
-
console.error(`Proxy error:`, err);
|
|
169
|
-
reject(err);
|
|
170
|
-
});
|
|
171
|
-
proxy.web(req, res, {
|
|
172
|
-
target,
|
|
173
|
-
timeout: PROXY_TIMEOUT,
|
|
174
|
-
proxyTimeout: PROXY_TIMEOUT,
|
|
175
|
-
selfHandleResponse: true,
|
|
176
|
-
followRedirects: false,
|
|
177
|
-
changeOrigin: true,
|
|
178
|
-
secure: true,
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
183
|
});
|
|
182
184
|
exports.handleProxy = handleProxy;
|
|
183
185
|
//# sourceMappingURL=proxy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../../src/lib/handlers/api/proxy.js"],"names":[],"mappings":";;;;AAAA,sDAAsD;AACtD,sEAAkC;AAClC,oEAAkC;AAClC,wFAAiD;AAEjD,uCAKoB;AACpB,
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../../src/lib/handlers/api/proxy.js"],"names":[],"mappings":";;;;AAAA,sDAAsD;AACtD,sEAAkC;AAClC,oEAAkC;AAClC,gEAAiC;AACjC,wFAAiD;AAEjD,uCAKoB;AACpB,4CAgBwB;AAExB,MAAM,aAAa,GAAG,IAAI,CAAA,CAAC,kBAAkB;AAE7C,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE;IACpE,MAAM,IAAI,GAAG,IAAA,oB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MAAM,EAAE,IAAI;aACb,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;KACH;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,qCAAqC,UAAU,GAAG,EAAE,KAAK,CAAC,CAAA;QACxE,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,KAAI,8BAA8B,EAAE,UAAU,EAAE,CAAC,CAAA;KACvG;AACH,CAAC,CAAA,CAAA;AA/OY,QAAA,WAAW,eA+OvB"}
|
|
@@ -103,9 +103,9 @@ const handleSessionToken = (serverRuntimeConfig, signingData) => {
|
|
|
103
103
|
}
|
|
104
104
|
console.log(`>>> > return > isVerifiable:`, { isVerifiable, verificationKeys });
|
|
105
105
|
if (isVerifiable && verificationKeys) {
|
|
106
|
-
const
|
|
107
|
-
console.log(`>>> > return >
|
|
108
|
-
return res.status(200).json(
|
|
106
|
+
const recrypted = yield shared_1.subtle.encryptMessage(JSON.stringify({ token }), verificationKeys.derivedSecretKey);
|
|
107
|
+
console.log(`>>> > return > recrypted:`, recrypted);
|
|
108
|
+
return res.status(200).json(recrypted);
|
|
109
109
|
}
|
|
110
110
|
return res.status(200).json({ token });
|
|
111
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agnostack/next-shopify",
|
|
3
|
-
"version": "1.13.4-beta.
|
|
3
|
+
"version": "1.13.4-beta.48",
|
|
4
4
|
"author": "agnoStack Dev <developers@agnostack.com> (https://agnostack.com)",
|
|
5
5
|
"owner": "agnoStack",
|
|
6
6
|
"description": "Please contact agnoStack via info@agnostack.com for any questions",
|