Skip to content

Commit 2ecc8e2

Browse files
committed
Reject control character injection attempts using paths
See GHSA-chqc-8p9q-pq6q
1 parent 515d21f commit 2ecc8e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,10 @@ export class Client {
760760
* a given path to fix that issue for most cases.
761761
*/
762762
async protectWhitespace(path: string): Promise<string> {
763+
// Reject CRLF injection attempts
764+
if (/[\r\n\0]/.test(path)) {
765+
throw new Error("Invalid path: Contains control characters");
766+
}
763767
if (!path.startsWith(" ")) {
764768
return path
765769
}

0 commit comments

Comments
 (0)