@uniformdev/canvas-next 20.67.0 → 20.67.1-alpha.23

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/dist/index.esm.js CHANGED
@@ -160,8 +160,17 @@ var resolveFullPathDefault = ({ slug, path }) => {
160
160
  return path || slug;
161
161
  };
162
162
  function validateLocalRedirectUrl(pathToRedirectTo) {
163
- if (pathToRedirectTo == null ? void 0 : pathToRedirectTo.match(/^[a-z]+:\/\//g)) {
164
- throw new Error("Tried to redirect to absolute URL with protocol. Disallowing open redirect.");
163
+ if (!pathToRedirectTo) {
164
+ return;
165
+ }
166
+ let resolved;
167
+ try {
168
+ resolved = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
169
+ } catch (e) {
170
+ throw new Error("Invalid redirect path. Disallowing open redirect.");
171
+ }
172
+ if (resolved.origin !== BASE_URL_EXAMPLE) {
173
+ throw new Error("Tried to redirect off-origin. Disallowing open redirect.");
165
174
  }
166
175
  }
167
176
  var assignRequestQueryToSearchParams = (searchParams, query) => {
package/dist/index.js CHANGED
@@ -202,8 +202,17 @@ var resolveFullPathDefault = ({ slug, path }) => {
202
202
  return path || slug;
203
203
  };
204
204
  function validateLocalRedirectUrl(pathToRedirectTo) {
205
- if (pathToRedirectTo == null ? void 0 : pathToRedirectTo.match(/^[a-z]+:\/\//g)) {
206
- throw new Error("Tried to redirect to absolute URL with protocol. Disallowing open redirect.");
205
+ if (!pathToRedirectTo) {
206
+ return;
207
+ }
208
+ let resolved;
209
+ try {
210
+ resolved = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
211
+ } catch (e) {
212
+ throw new Error("Invalid redirect path. Disallowing open redirect.");
213
+ }
214
+ if (resolved.origin !== BASE_URL_EXAMPLE) {
215
+ throw new Error("Tried to redirect off-origin. Disallowing open redirect.");
207
216
  }
208
217
  }
209
218
  var assignRequestQueryToSearchParams = (searchParams, query) => {
package/dist/index.mjs CHANGED
@@ -160,8 +160,17 @@ var resolveFullPathDefault = ({ slug, path }) => {
160
160
  return path || slug;
161
161
  };
162
162
  function validateLocalRedirectUrl(pathToRedirectTo) {
163
- if (pathToRedirectTo == null ? void 0 : pathToRedirectTo.match(/^[a-z]+:\/\//g)) {
164
- throw new Error("Tried to redirect to absolute URL with protocol. Disallowing open redirect.");
163
+ if (!pathToRedirectTo) {
164
+ return;
165
+ }
166
+ let resolved;
167
+ try {
168
+ resolved = new URL(pathToRedirectTo, BASE_URL_EXAMPLE);
169
+ } catch (e) {
170
+ throw new Error("Invalid redirect path. Disallowing open redirect.");
171
+ }
172
+ if (resolved.origin !== BASE_URL_EXAMPLE) {
173
+ throw new Error("Tried to redirect off-origin. Disallowing open redirect.");
165
174
  }
166
175
  }
167
176
  var assignRequestQueryToSearchParams = (searchParams, query) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next",
3
- "version": "20.67.0",
3
+ "version": "20.67.1-alpha.23+6cbc37f1d4",
4
4
  "description": "Next.js SDK for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -66,12 +66,12 @@
66
66
  "apidocs-extract": "api-extractor run --local"
67
67
  },
68
68
  "dependencies": {
69
- "@uniformdev/canvas": "20.67.0",
70
- "@uniformdev/canvas-react": "20.67.0",
71
- "@uniformdev/context": "20.67.0",
72
- "@uniformdev/project-map": "20.67.0",
73
- "@uniformdev/redirect": "20.67.0",
74
- "@uniformdev/richtext": "20.67.0",
69
+ "@uniformdev/canvas": "20.67.1-alpha.23+6cbc37f1d4",
70
+ "@uniformdev/canvas-react": "20.67.1-alpha.23+6cbc37f1d4",
71
+ "@uniformdev/context": "20.67.1-alpha.23+6cbc37f1d4",
72
+ "@uniformdev/project-map": "20.67.1-alpha.23+6cbc37f1d4",
73
+ "@uniformdev/redirect": "20.67.1-alpha.23+6cbc37f1d4",
74
+ "@uniformdev/richtext": "20.67.1-alpha.23+6cbc37f1d4",
75
75
  "colorette": "2.0.20"
76
76
  },
77
77
  "peerDependencies": {
@@ -91,5 +91,5 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "gitHead": "e97ff55db904f9f4b5c21a18a3ad21a94084684c"
94
+ "gitHead": "6cbc37f1d4431eddfc8e478612bb45463bc9b5bd"
95
95
  }