From 9a39bb9f95f30be63d5a33ff8a34396a26b4f9c1 Mon Sep 17 00:00:00 2001 From: Oleg Avdeev Date: Thu, 29 Jun 2023 20:43:57 -0700 Subject: [PATCH] sanitize / in secret names (#1470) * sanitize / in secret names Its not uncommon and even seems to be recommended by AWS to use `/` in AWS Secret Manager secret names. If used in conjunction with non-JSON secrets, it leads to issues here since we use secret name as environment variable name, and that can't contain `/` * fix formatting --- .../aws/secrets_manager/aws_secrets_manager_secrets_provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metaflow/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.py b/metaflow/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.py index eef87824408..42955532ce7 100644 --- a/metaflow/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.py +++ b/metaflow/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.py @@ -37,7 +37,7 @@ def _sanitize_key_as_env_var(key): Also, it's TBD whether all possible providers will share the same sanitization logic. Therefore we will keep this function private for now """ - return key.replace("-", "_").replace(".", "_") + return key.replace("-", "_").replace(".", "_").replace("/", "_") class AwsSecretsManagerSecretsProvider(SecretsProvider):