org.sonar.l10n.py.rules.python.S6319.html Maven / Gradle / Ivy
Amazon SageMaker is a managed machine learning service in a hosted production-ready environment. To train machine learning models, SageMaker
instances can process potentially sensitive data, such as personal information that should not be stored unencrypted. In the event that adversaries
physically access the storage media, they cannot decrypt encrypted data.
Ask Yourself Whether
- The instance contains sensitive data that could cause harm when leaked.
- There are compliance requirements for the service to store data encrypted.
There is a risk if you answered yes to any of those questions.
Recommended Secure Coding Practices
It’s recommended to encrypt SageMaker notebook instances that contain sensitive information. Encryption and decryption are handled transparently by
SageMaker, so no further modifications to the application are necessary.
Sensitive Code Example
For aws_cdk.aws_sagemaker.CfnNotebookInstance:
from aws_cdk import (
aws_sagemaker as sagemaker
)
class CfnSagemakerStack(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
sagemaker.CfnNotebookInstance(
self, "Sensitive",
instance_type="instanceType",
role_arn="roleArn"
) # Sensitive, no KMS key is set by default; thus, encryption is disabled
Compliant Solution
For aws_cdk.aws_sagemaker.CfnNotebookInstance:
from aws_cdk import (
aws_sagemaker as sagemaker,
aws_kms as kms
)
class CfnSagemakerStack(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
my_key = kms.Key(self, "Key")
sagemaker.CfnNotebookInstance(
self, "Compliant",
instance_type="instanceType",
role_arn="roleArn",
kms_key_id=my_key.key_id
)
See
- Protect Data at Rest Using Encryption
- CWE - CWE-311 - Missing Encryption of Sensitive Data
- STIG Viewer - Application Security and
Development: V-222588 - The application must implement approved cryptographic mechanisms to prevent unauthorized modification of information at
rest.
© 2015 - 2024 Weber Informatics LLC | Privacy Policy