@@ -9,11 +9,19 @@ suite('validateSafeBinaryPath', () => {
99 strictEqual ( validateSafeBinaryPath ( '/opt/oxc_language_server' ) , true ) ;
1010 } ) ;
1111
12+ test ( 'should accept case variations of oxc_language_server' , ( ) => {
13+ strictEqual ( validateSafeBinaryPath ( 'OXC_LANGUAGE_SERVER' ) , true ) ;
14+ strictEqual ( validateSafeBinaryPath ( 'OXC_LANGUAGE_SERVER.exe' ) , true ) ;
15+ strictEqual ( validateSafeBinaryPath ( '/usr/local/bin/OXC_LANGUAGE_SERVER' ) , true ) ;
16+ strictEqual ( validateSafeBinaryPath ( 'C:\\Program Files\\OXC_LANGUAGE_SERVER.exe' ) , true ) ;
17+ } ) ;
18+
1219 test ( 'should reject paths with directory traversal' , ( ) => {
1320 strictEqual ( validateSafeBinaryPath ( '../oxc_language_server' ) , false ) ;
1421 strictEqual ( validateSafeBinaryPath ( '../../oxc_language_server' ) , false ) ;
1522 strictEqual ( validateSafeBinaryPath ( '/usr/local/../bin/oxc_language_server' ) , false ) ;
1623 strictEqual ( validateSafeBinaryPath ( '..\\oxc_language_server' ) , false ) ;
24+ strictEqual ( validateSafeBinaryPath ( '.\\oxc_language_server' ) , false ) ;
1725 } ) ;
1826
1927 test ( 'should reject paths with malicious characters' , ( ) => {
@@ -24,6 +32,10 @@ suite('validateSafeBinaryPath', () => {
2432 strictEqual ( validateSafeBinaryPath ( 'oxc_language_server<input.txt' ) , false ) ;
2533 strictEqual ( validateSafeBinaryPath ( 'oxc_language_server`whoami`' ) , false ) ;
2634 strictEqual ( validateSafeBinaryPath ( 'oxc_language_server!' ) , false ) ;
35+
36+ // windows specific
37+ strictEqual ( validateSafeBinaryPath ( 'oxc_language_server^&pause' ) , false ) ;
38+ strictEqual ( validateSafeBinaryPath ( 'oxc_language_server & del /f *' ) , false ) ;
2739 } ) ;
2840
2941 test ( 'should reject paths not containing oxc_language_server' , ( ) => {
@@ -32,5 +44,7 @@ suite('validateSafeBinaryPath', () => {
3244 strictEqual ( validateSafeBinaryPath ( '' ) , false ) ;
3345 strictEqual ( validateSafeBinaryPath ( 'oxc_language' ) , false ) ;
3446 strictEqual ( validateSafeBinaryPath ( 'language_server' ) , false ) ;
47+ strictEqual ( validateSafeBinaryPath ( '/oxc_language_server/malicious' ) , false ) ;
48+ strictEqual ( validateSafeBinaryPath ( 'C:\\oxc_language_server\\evil.exe' ) , false ) ;
3549 } ) ;
3650} ) ;
0 commit comments