-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(HIPAA Security): EFS check (#346)
Closes #244 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
6 changed files
with
86 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { CfnFileSystem } from '@aws-cdk/aws-efs'; | ||
import { IConstruct, Stack } from '@aws-cdk/core'; | ||
|
||
/** | ||
* Elastic File Systems are configured for encryption at rest - (Control IDs: 164.312(a)(2)(iv), 164.312(e)(2)(ii)) | ||
* @param node the CfnResource to check | ||
*/ | ||
export default function (node: IConstruct): boolean { | ||
if (node instanceof CfnFileSystem) { | ||
const encrypted = Stack.of(node).resolve(node.encrypted); | ||
if (encrypted === false) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { SynthUtils } from '@aws-cdk/assert'; | ||
import { Vpc } from '@aws-cdk/aws-ec2'; | ||
import { FileSystem } from '@aws-cdk/aws-efs'; | ||
import { Aspects, Stack } from '@aws-cdk/core'; | ||
import { HIPAASecurityChecks } from '../../src'; | ||
|
||
describe('Amazon Elastic File System (Amazon EFS)', () => { | ||
test('hipaaSecurityEFSEncrypted: - Elastic File Systems are configured for encryption at rest - (Control IDs: 164.312(a)(2)(iv), 164.312(e)(2)(ii))', () => { | ||
const nonCompliant = new Stack(); | ||
Aspects.of(nonCompliant).add(new HIPAASecurityChecks()); | ||
new FileSystem(nonCompliant, 'rEFS', { | ||
vpc: new Vpc(nonCompliant, 'rVpc'), | ||
encrypted: false, | ||
}); | ||
const messages = SynthUtils.synthesize(nonCompliant).messages; | ||
expect(messages).toContainEqual( | ||
expect.objectContaining({ | ||
entry: expect.objectContaining({ | ||
data: expect.stringContaining('HIPAA.Security-EFSEncrypted:'), | ||
}), | ||
}) | ||
); | ||
const compliant = new Stack(); | ||
Aspects.of(compliant).add(new HIPAASecurityChecks()); | ||
new FileSystem(compliant, 'rEFS', { | ||
vpc: new Vpc(compliant, 'rVpc'), | ||
}); | ||
const messages2 = SynthUtils.synthesize(compliant).messages; | ||
expect(messages2).not.toContainEqual( | ||
expect.objectContaining({ | ||
entry: expect.objectContaining({ | ||
data: expect.stringContaining('HIPAA.Security-EFSEncrypted:'), | ||
}), | ||
}) | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters