File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -439,6 +439,28 @@ describe('Path Validation', () => {
439439 expect ( isPathWithinAllowedDirectories ( '\\\\other\\share\\project' , allowed ) ) . toBe ( false ) ;
440440 }
441441 } ) ;
442+
443+ it ( 'allows UNC path within allowed UNC directory' , ( ) => {
444+ if ( path . sep === '\\' ) {
445+ const allowed = [ '\\\\server\\share\\project' ] ;
446+ expect ( isPathWithinAllowedDirectories ( '\\\\server\\share\\project\\subdir\\file.txt' , allowed ) ) . toBe ( true ) ;
447+ }
448+ } ) ;
449+
450+ it ( 'blocks UNC path outside allowed UNC directory' , ( ) => {
451+ if ( path . sep === '\\' ) {
452+ const allowed = [ '\\\\server\\share\\project' ] ;
453+ expect ( isPathWithinAllowedDirectories ( '\\\\server\\share\\other' , allowed ) ) . toBe ( false ) ;
454+ expect ( isPathWithinAllowedDirectories ( '\\\\other\\share\\project' , allowed ) ) . toBe ( false ) ;
455+ }
456+ } ) ;
457+
458+ it ( 'allows exact UNC path match' , ( ) => {
459+ if ( path . sep === '\\' ) {
460+ const allowed = [ '\\\\server\\share\\project' ] ;
461+ expect ( isPathWithinAllowedDirectories ( '\\\\server\\share\\project' , allowed ) ) . toBe ( true ) ;
462+ }
463+ } ) ;
442464 } ) ;
443465
444466 describe ( 'Symlink Tests' , ( ) => {
You can’t perform that action at this time.
0 commit comments