fix(security): reject all control bytes in Origin validation
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
2 files changed
+15
-2
No files matched your search
+1
-1
@@ -23,7 +23,7 @@ type Headers = Record<string, string>;
|
||||
const HSTS_DEFAULT_MAXAGE = 15552000; // 180 days
|
||||
|
||||
// scheme "://" host [":" port], or literal "null". Rejects control chars/whitespace.
|
||||
const ORIGIN_RE = /^(?:null|[a-z][a-z0-9+.-]*:\/\/[^\s/?#]+)$/i;
|
||||
const ORIGIN_RE = /^(?:null|[a-z][a-z0-9+.-]*:\/\/[^\s/?#\x00-\x1f\x7f]+)$/i;
|
||||
export function isValidOrigin(o: string): boolean { return ORIGIN_RE.test(o); }
|
||||
|
||||
export function mergeVary(existing: string | undefined, add: string): string {
|
||||
|
||||
Reference in new issue
Block a user