@@ -6,6 +6,7 @@ import Aws_CIS_140_211 from '../rules/aws-cis-1.4.0-2.1.1'
66import Aws_CIS_140_212 from '../rules/aws-cis-1.4.0-2.1.2'
77import Aws_CIS_140_213 from '../rules/aws-cis-1.4.0-2.1.3'
88import Aws_CIS_140_215 from '../rules/aws-cis-1.4.0-2.1.5'
9+ import Aws_CIS_140_221 from '../rules/aws-cis-1.4.0-2.2.1'
910import Aws_CIS_140_231 from '../rules/aws-cis-1.4.0-2.3.1'
1011
1112export interface Condition {
@@ -49,8 +50,13 @@ export interface QueryawsS3 {
4950 encrypted ?: string
5051 encryptionRules ?: EncryptionRule [ ]
5152}
53+ export interface QueryawsEbs {
54+ id : string
55+ encrypted : boolean
56+ }
5257export interface CIS2xQueryResponse {
5358 queryawsS3 ?: QueryawsS3 [ ]
59+ queryawsEbs ?: QueryawsEbs [ ]
5460 queryawsRdsDbInstance ?: QueryawsRdsDbInstance [ ]
5561}
5662
@@ -358,6 +364,44 @@ describe('CIS Amazon Web Services Foundations: 1.4.0', () => {
358364 } )
359365 } )
360366
367+ describe ( 'AWS CIS 2.2.1 Ensure EBS volume encryption is enabled' , ( ) => {
368+ const getTestRuleFixture = ( encrypted : boolean ) : CIS2xQueryResponse => {
369+ return {
370+ queryawsEbs : [
371+ {
372+ id : cuid ( ) ,
373+ encrypted,
374+ } ,
375+ ] ,
376+ }
377+ }
378+
379+ // Act
380+ const testRule = async (
381+ data : CIS2xQueryResponse ,
382+ expectedResult : Result
383+ ) : Promise < void > => {
384+ // Act
385+ const [ processedRule ] = await rulesEngine . processRule (
386+ Aws_CIS_140_221 as Rule ,
387+ { ...data }
388+ )
389+
390+ // Asserts
391+ expect ( processedRule . result ) . toBe ( expectedResult )
392+ }
393+
394+ test ( 'No Security Issue when EBS volume encryption is enabled' , async ( ) => {
395+ const data : CIS2xQueryResponse = getTestRuleFixture ( true )
396+ await testRule ( data , Result . PASS )
397+ } )
398+
399+ test ( 'Security Issue when EBS volume encryption is not enabled' , async ( ) => {
400+ const data : CIS2xQueryResponse = getTestRuleFixture ( false )
401+ await testRule ( data , Result . FAIL )
402+ } )
403+ } )
404+
361405 describe ( 'AWS CIS 2.3.1 Ensure that encryption is enabled for RDS Instances' , ( ) => {
362406 const getTestRuleFixture = ( encrypted : boolean ) : CIS2xQueryResponse => {
363407 return {
0 commit comments