AWS 람다 함수 내부에는 OS 환경에서 중요한 정보를 찾는 라이브러리가 있습니다. KMS를 사용하여 환경을 암호화 할 수 있지만 람다 (lambda) 처리기 모듈에서 암호화 된 환경 변수를 덮어 써야한다는 것을 알았습니다 - 이것이 취약점입니까? 예 :AWS Lambda 내부의 환경 변수를 해독하고 설정하는 것이 취약점입니까?
# lambda_handler.py
encrypted_env_var = os.environ["SECRET_KEY"]
decrypted_env_var = decrypt(encrypted_env_var)
os.environ["SECRET_KEY"] = decrypted_env_var
def lambda_function(event, context):
... libs get and use SECRET_KEY ...
본인은 암호화하는 것이 귀하를 포괄 함을 이해합니다. awscli를 사용할 때 컨테이너에 이것을 설정할 수 있습니까? here에서 알 수 있듯이, 컨테이너가 즉시 파괴되지 않을 수도 있습니다.
# lambda_handler.py
ENCRYPTED = os.environ['SECRET_KEY']
# Decrypt code should run once and variables stored outside of the function
# handler so that these are decrypted once per container
DECRYPTED = boto3.client('kms').decrypt(CiphertextBlob=b64decode(ENCRYPTED))['Plaintext']
def lambda_handler(event, context):
# handle the event here
그것 (지저분한이기는하지만) 충분할 것이다 단지 해제 관련 변수 :
또한, 제안 된 암호 해독 코드에서 AWS가 (람다 대시 보드)를 제공 니펫, 코멘트 내 관심을 끌었 함수의 끝에서?
덕분에