We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a4fcef commit 07d009aCopy full SHA for 07d009a
packages/angular/ssr/src/utils/headers.ts
@@ -21,6 +21,11 @@ const VALID_PROTO_REGEX = /^https?$/i;
21
*/
22
const WWW_HOST_REGEX = /^www\./i;
23
24
+/**
25
+ * Regular expression to match path separators.
26
+ */
27
+const PATH_SEPARATOR_REGEX = /[/\\]/;
28
+
29
/**
30
* Set of hostnames that are always allowed.
31
@@ -98,7 +103,7 @@ function validateHost(
98
103
}
99
104
100
105
// Reject any hostname containing path separators - they're invalid.
101
- if (value.includes('/')) {
106
+ if (PATH_SEPARATOR_REGEX.test(value)) {
102
107
throw new Error(`Header "${headerName}" contains path separators which is not allowed.`);
108
109
0 commit comments