@@ -242,7 +242,7 @@ describe('RuleEngine', () => {
242242
243243 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
244244 // May be blocked by catastrophic path detection OR chained command validation
245- expect ( result . reason ) . toMatch ( / C a t a s t r o p h i c p a t h | C h a i n e d c o m m a n d b l o c k e d / ) ;
245+ expect ( result . reason ) . toMatch ( / c r i t i c a l s y s t e m \/ u s e r | C h a i n e d c o m m a n d b l o c k e d / ) ;
246246 } ) ;
247247
248248 it ( 'blocks chain if first segment is blocked' , ( ) => {
@@ -339,7 +339,7 @@ describe('RuleEngine', () => {
339339
340340 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
341341 // May be blocked by catastrophic path detection OR chained command validation
342- expect ( result . reason ) . toMatch ( / C a t a s t r o p h i c p a t h | C h a i n e d c o m m a n d b l o c k e d / ) ;
342+ expect ( result . reason ) . toMatch ( / c r i t i c a l s y s t e m \/ u s e r | C h a i n e d c o m m a n d b l o c k e d / ) ;
343343 } ) ;
344344
345345 it ( 'allows chain with default policy when no rules match' , ( ) => {
@@ -356,7 +356,7 @@ describe('RuleEngine', () => {
356356 } ) ;
357357 } ) ;
358358
359- describe ( 'Catastrophic path detection' , ( ) => {
359+ describe ( 'critical system\/user detection' , ( ) => {
360360 /**
361361 * Tests for the catastrophic path detection feature.
362362 * This catches attacks like "rm -rf node_modules dist ~/" where dangerous paths
@@ -386,8 +386,8 @@ describe('RuleEngine', () => {
386386 const result = engine . validate ( command , rules ) ;
387387
388388 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
389- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
390- expect ( result . reason ) . toContain ( 'critical system/user files' ) ;
389+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
390+ expect ( result . reason ) . toContain ( 'critical system\ /user files' ) ;
391391 } ) ;
392392
393393 it ( 'should block rm -rf with ~ (tilde) hidden among arguments' , ( ) => {
@@ -399,7 +399,7 @@ describe('RuleEngine', () => {
399399 const result = engine . validate ( command , rules ) ;
400400
401401 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
402- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
402+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
403403 } ) ;
404404
405405 it ( 'should block rm -rf /' , ( ) => {
@@ -409,7 +409,7 @@ describe('RuleEngine', () => {
409409 const result = engine . validate ( command , rules ) ;
410410
411411 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
412- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
412+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
413413 } ) ;
414414
415415 it ( 'should block rm -rf /home' , ( ) => {
@@ -419,7 +419,7 @@ describe('RuleEngine', () => {
419419 const result = engine . validate ( command , rules ) ;
420420
421421 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
422- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
422+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
423423 } ) ;
424424
425425 it ( 'should block rm -rf /etc' , ( ) => {
@@ -429,7 +429,7 @@ describe('RuleEngine', () => {
429429 const result = engine . validate ( command , rules ) ;
430430
431431 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
432- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
432+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
433433 } ) ;
434434
435435 it ( 'should block rm -r (without -f) with catastrophic paths' , ( ) => {
@@ -440,7 +440,7 @@ describe('RuleEngine', () => {
440440 const result = engine . validate ( command , rules ) ;
441441
442442 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
443- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
443+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
444444 } ) ;
445445
446446 it ( 'should block rm with combined flags like -fR' , ( ) => {
@@ -451,7 +451,7 @@ describe('RuleEngine', () => {
451451 const result = engine . validate ( command , rules ) ;
452452
453453 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
454- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
454+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
455455 } ) ;
456456
457457 it ( 'should NOT block rm -rf with safe paths only' , ( ) => {
@@ -492,7 +492,7 @@ describe('RuleEngine', () => {
492492 const result = engine . validate ( command , rules ) ;
493493
494494 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
495- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
495+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
496496 } ) ;
497497
498498 it ( 'should block rm -rf with /usr' , ( ) => {
@@ -502,7 +502,7 @@ describe('RuleEngine', () => {
502502 const result = engine . validate ( command , rules ) ;
503503
504504 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
505- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
505+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
506506 } ) ;
507507
508508 it ( 'catastrophic path check runs before pattern rules' , ( ) => {
@@ -515,7 +515,7 @@ describe('RuleEngine', () => {
515515
516516 // Should still be blocked despite the ALLOW rule
517517 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
518- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
518+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
519519 } ) ;
520520 } ) ;
521521
@@ -549,7 +549,7 @@ describe('RuleEngine', () => {
549549 const result = engine . validate ( command , rules ) ;
550550
551551 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
552- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
552+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
553553 expect ( result . reason ) . toContain ( 'via sudo' ) ;
554554 } ) ;
555555
@@ -560,7 +560,7 @@ describe('RuleEngine', () => {
560560 const result = engine . validate ( command , rules ) ;
561561
562562 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
563- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
563+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
564564 } ) ;
565565
566566 it ( 'should block sudo -u root rm -rf /' , ( ) => {
@@ -570,7 +570,7 @@ describe('RuleEngine', () => {
570570 const result = engine . validate ( command , rules ) ;
571571
572572 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
573- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
573+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
574574 } ) ;
575575
576576 it ( 'should block bash -c "rm -rf /"' , ( ) => {
@@ -580,7 +580,7 @@ describe('RuleEngine', () => {
580580 const result = engine . validate ( command , rules ) ;
581581
582582 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
583- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
583+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
584584 expect ( result . reason ) . toContain ( 'via bash -c' ) ;
585585 } ) ;
586586
@@ -592,7 +592,7 @@ describe('RuleEngine', () => {
592592 const result = engine . validate ( command , rules ) ;
593593
594594 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
595- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
595+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
596596 } ) ;
597597
598598 it ( 'should block sudo bash -c "rm -rf /"' , ( ) => {
@@ -602,7 +602,7 @@ describe('RuleEngine', () => {
602602 const result = engine . validate ( command , rules ) ;
603603
604604 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
605- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
605+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
606606 expect ( result . reason ) . toContain ( 'via sudo' ) ;
607607 expect ( result . reason ) . toContain ( 'bash -c' ) ;
608608 } ) ;
@@ -614,7 +614,7 @@ describe('RuleEngine', () => {
614614 const result = engine . validate ( command , rules ) ;
615615
616616 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
617- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
617+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
618618 } ) ;
619619
620620 it ( 'should block xargs rm -rf with recursive flag' , ( ) => {
@@ -658,7 +658,7 @@ describe('RuleEngine', () => {
658658 const result = engine . validate ( command , rules ) ;
659659
660660 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
661- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
661+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
662662 } ) ;
663663
664664 it ( 'should block timeout 30 rm -rf /' , ( ) => {
@@ -668,7 +668,7 @@ describe('RuleEngine', () => {
668668 const result = engine . validate ( command , rules ) ;
669669
670670 expect ( result . action ) . toBe ( ValidationAction . BLOCK ) ;
671- expect ( result . reason ) . toContain ( 'Catastrophic path ' ) ;
671+ expect ( result . reason ) . toContain ( 'critical system\/user ' ) ;
672672 } ) ;
673673
674674 it ( 'should NOT block sudo ls -la' , ( ) => {
0 commit comments