@@ -653,4 +653,120 @@ describe('ChangeRequestSchema', () => {
653653
654654 expect ( ( ) => ChangeRequestSchema . parse ( rolledBackChange ) ) . not . toThrow ( ) ;
655655 } ) ;
656+
657+ it ( 'should accept change with security impact assessment (A.8.32)' , ( ) => {
658+ const changeWithSecurityImpact = {
659+ id : 'CHG-2024-SEC-001' ,
660+ title : 'API Gateway Configuration Change' ,
661+ description : 'Update API gateway security headers' ,
662+ type : 'normal' ,
663+ priority : 'high' ,
664+ status : 'approved' ,
665+ requestedBy : 'security_team' ,
666+ requestedAt : Date . now ( ) ,
667+ impact : {
668+ level : 'high' ,
669+ affectedSystems : [ 'api-gateway' ] ,
670+ } ,
671+ implementation : {
672+ description : 'Update security headers' ,
673+ steps : [
674+ {
675+ order : 1 ,
676+ description : 'Deploy configuration' ,
677+ estimatedMinutes : 10 ,
678+ } ,
679+ ] ,
680+ } ,
681+ rollbackPlan : {
682+ description : 'Revert configuration' ,
683+ steps : [
684+ {
685+ order : 1 ,
686+ description : 'Restore previous config' ,
687+ estimatedMinutes : 5 ,
688+ } ,
689+ ] ,
690+ } ,
691+ securityImpact : {
692+ assessed : true ,
693+ riskLevel : 'high' ,
694+ affectedDataClassifications : [ 'pii' , 'confidential' ] ,
695+ requiresSecurityApproval : true ,
696+ reviewedBy : 'ciso' ,
697+ reviewedAt : Date . now ( ) ,
698+ reviewNotes : 'Approved with monitoring requirement' ,
699+ } ,
700+ } ;
701+
702+ const parsed = ChangeRequestSchema . parse ( changeWithSecurityImpact ) ;
703+ expect ( parsed . securityImpact ?. assessed ) . toBe ( true ) ;
704+ expect ( parsed . securityImpact ?. riskLevel ) . toBe ( 'high' ) ;
705+ expect ( parsed . securityImpact ?. requiresSecurityApproval ) . toBe ( true ) ;
706+ } ) ;
707+
708+ it ( 'should accept change with minimal security impact' , ( ) => {
709+ const change = {
710+ id : 'CHG-2024-SEC-002' ,
711+ title : 'Minor UI Change' ,
712+ description : 'Update button color' ,
713+ type : 'standard' ,
714+ priority : 'low' ,
715+ status : 'draft' ,
716+ requestedBy : 'user_123' ,
717+ requestedAt : Date . now ( ) ,
718+ impact : {
719+ level : 'low' ,
720+ affectedSystems : [ 'ui' ] ,
721+ } ,
722+ implementation : {
723+ description : 'Update CSS' ,
724+ steps : [ { order : 1 , description : 'Deploy' , estimatedMinutes : 5 } ] ,
725+ } ,
726+ rollbackPlan : {
727+ description : 'Revert CSS' ,
728+ steps : [ { order : 1 , description : 'Revert' , estimatedMinutes : 5 } ] ,
729+ } ,
730+ securityImpact : {
731+ assessed : true ,
732+ riskLevel : 'none' ,
733+ } ,
734+ } ;
735+
736+ const parsed = ChangeRequestSchema . parse ( change ) ;
737+ expect ( parsed . securityImpact ?. riskLevel ) . toBe ( 'none' ) ;
738+ expect ( parsed . securityImpact ?. requiresSecurityApproval ) . toBe ( false ) ;
739+ } ) ;
740+
741+ it ( 'should accept all security risk levels' , ( ) => {
742+ const levels = [ 'none' , 'low' , 'medium' , 'high' , 'critical' ] as const ;
743+
744+ levels . forEach ( ( riskLevel ) => {
745+ const change = {
746+ id : `CHG-${ riskLevel } ` ,
747+ title : 'Test' ,
748+ description : 'Test' ,
749+ type : 'standard' ,
750+ priority : 'low' ,
751+ status : 'draft' ,
752+ requestedBy : 'user' ,
753+ requestedAt : Date . now ( ) ,
754+ impact : { level : 'low' , affectedSystems : [ 'test' ] } ,
755+ implementation : {
756+ description : 'Test' ,
757+ steps : [ { order : 1 , description : 'Test' , estimatedMinutes : 5 } ] ,
758+ } ,
759+ rollbackPlan : {
760+ description : 'Test' ,
761+ steps : [ { order : 1 , description : 'Test' , estimatedMinutes : 5 } ] ,
762+ } ,
763+ securityImpact : {
764+ assessed : true ,
765+ riskLevel,
766+ } ,
767+ } ;
768+
769+ expect ( ( ) => ChangeRequestSchema . parse ( change ) ) . not . toThrow ( ) ;
770+ } ) ;
771+ } ) ;
656772} ) ;
0 commit comments