We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8528f1b commit 1d0b9fbCopy full SHA for 1d0b9fb
library/vulnerabilities/path-traversal/containsUnsafePathParts.ts
@@ -20,5 +20,6 @@ export function containsUnsafePathParts(filePath: string) {
20
* See https://url.spec.whatwg.org/#url-parsing
21
*/
22
export function containsUnsafePathPartsUrl(filePath: string) {
23
- return /(?:\.(?:\t|\n|\r)*){2}(?:\/|\\)/.test(filePath);
+ const normalized = filePath.replace(/[\t\n\r]/g, "");
24
+ return containsUnsafePathParts(normalized);
25
}
0 commit comments