include::../description.adoc[]

include::../ask-yourself.adoc[]

include::../recommended.adoc[]

== Sensitive Code Example

For https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_efs.FileSystem.html[`aws_cdk.aws_efs.FileSystem`]

[source,javascript]
----
import { FileSystem } from 'aws-cdk-lib/aws-efs';

new FileSystem(this, 'unencrypted-explicit', {
    vpc: new Vpc(this, 'VPC'),
    encrypted: false // Sensitive
});
----

For https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_efs.CfnFileSystem.html[`aws_cdk.aws_efs.CfnFileSystem`]

[source,javascript]
----
import { CfnFileSystem } from 'aws-cdk-lib/aws-efs';

new CfnFileSystem(this, 'unencrypted-implicit-cfn', {
}); // Sensitive as encryption is disabled by default
----

== Compliant Solution

For https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_efs.FileSystem.html[`aws_cdk.aws_efs.FileSystem`]

[source,javascript]
----
import { FileSystem } from 'aws-cdk-lib/aws-efs';

new FileSystem(this, 'encrypted-explicit', {
    vpc: new Vpc(this, 'VPC'),
    encrypted: true
});
----

For https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_efs.CfnFileSystem.html[`aws_cdk.aws_efs.CfnFileSystem`]

[source,javascript]
----
import { CfnFileSystem } from 'aws-cdk-lib/aws-efs';

new CfnFileSystem(this, 'encrypted-explicit-cfn', {
    encrypted: true
});
----

include::../see.adoc[]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

For FileSystem:

* Make sure that using unencrypted file systems is safe here.

For CfnFileSystem:

* Make sure that using unencrypted file systems is safe here.
* Omitting "encrypted" disables EFS encryption. Make sure it is safe here.

=== Highlighting

* Highlight the `props` object if it does not contain the property `encrypted` (only for CfnFileSystem).
* Highlight the `encrypted` property if it is not set to `true`.

endif::env-github,rspecator-view[]