From aee5ac1de71bb342085bd1aee83fa7fe405d6f00 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Wed, 28 Feb 2024 23:30:59 +0100 Subject: [PATCH 1/7] Clarify environment variable substitution is not reccursive Fixes #3894 --- specification/configuration/file-configuration.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/specification/configuration/file-configuration.md b/specification/configuration/file-configuration.md index b530ee73ab1..2922ea8acb1 100644 --- a/specification/configuration/file-configuration.md +++ b/specification/configuration/file-configuration.md @@ -94,6 +94,9 @@ or floating point fields can be properly converted to expected types. It MUST NOT be possible to inject YAML structures by environment variables. For example, references to `INVALID_MAP_VALUE` environment variable below. +It MUST NOT be possible to inject environment variable by environment variables. +For example, references to `DO_NOT_REPLACE_ME` environment variable below. + For example, consider the following environment variables, and [YAML](#yaml-file-format) configuration file: @@ -102,7 +105,9 @@ export STRING_VALUE="value" export BOOl_VALUE="true" export INT_VALUE="1" export FLOAT_VALUE="1.1" -export INVALID_MAP_VALUE"value\nkey:value" # An invalid attempt to inject a map key into the YAML +export INVALID_MAP_VALUE="value\nkey:value" # An invalid attempt to inject a map key into the YAML +export REPLACE_ME='${DO_NOT_REPLACE_ME}' # A valid replacement text +export DO_NOT_REPLACE_ME="Never use this value" # An invalid attempt to recursively substitute environment variables ``` ```yaml @@ -116,6 +121,7 @@ float_key: ${FLOAT_VALUE} # Valid reference to FLOAT combo_string_key: foo ${STRING_VALUE} ${FLOAT_VALUE} # Valid reference to STRING_VALUE and FLOAT_VALUE undefined_key: ${UNDEFINED_KEY} # Invalid reference, UNDEFINED_KEY is not defined and is replaced with "" ${STRING_VALUE}: value # Invalid reference, substitution is not valid in mapping keys and reference is ignored +reccursive_key: ${REPLACE_ME} # Valid reference to REPLACE_ME ``` Environment variable substitution results in the following YAML: @@ -131,6 +137,7 @@ float_key: 1.1 # Interpreted as type float, tag URI combo_string_key: foo value 1.1 # Interpreted as type string, tag URI tag:yaml.org,2002:str undefined_key: # Interpreted as type null, tag URI tag:yaml.org,2002:null ${STRING_VALUE}: value # Interpreted as type string, tag URI tag:yaml.org,2002:str +reccursive_key: ${DO_NOT_REPLACE_ME} # Interpreted as type string, tag URI tag:yaml.org,2002:str ``` ## SDK Configuration From dfab97327895c15608517e938130d1162ac3229e Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 29 Feb 2024 01:24:06 +0100 Subject: [PATCH 2/7] Better formating --- specification/configuration/file-configuration.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/specification/configuration/file-configuration.md b/specification/configuration/file-configuration.md index 2922ea8acb1..a69e0c74fc9 100644 --- a/specification/configuration/file-configuration.md +++ b/specification/configuration/file-configuration.md @@ -105,9 +105,9 @@ export STRING_VALUE="value" export BOOl_VALUE="true" export INT_VALUE="1" export FLOAT_VALUE="1.1" -export INVALID_MAP_VALUE="value\nkey:value" # An invalid attempt to inject a map key into the YAML -export REPLACE_ME='${DO_NOT_REPLACE_ME}' # A valid replacement text -export DO_NOT_REPLACE_ME="Never use this value" # An invalid attempt to recursively substitute environment variables +export INVALID_MAP_VALUE="value\nkey:value" # An invalid attempt to inject a map key into the YAML +export REPLACE_ME='${DO_NOT_REPLACE_ME}' # A valid replacement text +export DO_NOT_REPLACE_ME="Never use this value" # An invalid attempt to recursively substitute environment variables ``` ```yaml From dcb2d8727ff821faa90f37de6f13ffef6d1846f4 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 29 Feb 2024 09:19:42 +0100 Subject: [PATCH 3/7] Update specification/configuration/file-configuration.md Co-authored-by: Trask Stalnaker --- specification/configuration/file-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/configuration/file-configuration.md b/specification/configuration/file-configuration.md index a69e0c74fc9..28f973120b4 100644 --- a/specification/configuration/file-configuration.md +++ b/specification/configuration/file-configuration.md @@ -121,7 +121,7 @@ float_key: ${FLOAT_VALUE} # Valid reference to FLOAT combo_string_key: foo ${STRING_VALUE} ${FLOAT_VALUE} # Valid reference to STRING_VALUE and FLOAT_VALUE undefined_key: ${UNDEFINED_KEY} # Invalid reference, UNDEFINED_KEY is not defined and is replaced with "" ${STRING_VALUE}: value # Invalid reference, substitution is not valid in mapping keys and reference is ignored -reccursive_key: ${REPLACE_ME} # Valid reference to REPLACE_ME +recursive_key: ${REPLACE_ME} # Valid reference to REPLACE_ME ``` Environment variable substitution results in the following YAML: From c5e7918f91d0b6842aa27ac2bced5321adf84fbe Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 29 Feb 2024 09:19:53 +0100 Subject: [PATCH 4/7] Update specification/configuration/file-configuration.md Co-authored-by: Trask Stalnaker --- specification/configuration/file-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/configuration/file-configuration.md b/specification/configuration/file-configuration.md index 28f973120b4..0a38a428b8e 100644 --- a/specification/configuration/file-configuration.md +++ b/specification/configuration/file-configuration.md @@ -137,7 +137,7 @@ float_key: 1.1 # Interpreted as type float, tag URI combo_string_key: foo value 1.1 # Interpreted as type string, tag URI tag:yaml.org,2002:str undefined_key: # Interpreted as type null, tag URI tag:yaml.org,2002:null ${STRING_VALUE}: value # Interpreted as type string, tag URI tag:yaml.org,2002:str -reccursive_key: ${DO_NOT_REPLACE_ME} # Interpreted as type string, tag URI tag:yaml.org,2002:str +recursive_key: ${DO_NOT_REPLACE_ME} # Interpreted as type string, tag URI tag:yaml.org,2002:str ``` ## SDK Configuration From 7de9059b185ec5a963bb160f7454fcee955cfc2a Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 29 Feb 2024 21:13:57 +0100 Subject: [PATCH 5/7] Fix review comments. --- specification/configuration/file-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/configuration/file-configuration.md b/specification/configuration/file-configuration.md index 0a38a428b8e..b2558cf2d3a 100644 --- a/specification/configuration/file-configuration.md +++ b/specification/configuration/file-configuration.md @@ -107,7 +107,7 @@ export INT_VALUE="1" export FLOAT_VALUE="1.1" export INVALID_MAP_VALUE="value\nkey:value" # An invalid attempt to inject a map key into the YAML export REPLACE_ME='${DO_NOT_REPLACE_ME}' # A valid replacement text -export DO_NOT_REPLACE_ME="Never use this value" # An invalid attempt to recursively substitute environment variables +export DO_NOT_REPLACE_ME="Never use this value" ``` ```yaml From 80d586317f24f42226345c00979c7900e49ced4f Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Sat, 2 Mar 2024 13:58:52 +0100 Subject: [PATCH 6/7] Rewording for more clarity. --- specification/configuration/file-configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specification/configuration/file-configuration.md b/specification/configuration/file-configuration.md index b2558cf2d3a..6e75166befc 100644 --- a/specification/configuration/file-configuration.md +++ b/specification/configuration/file-configuration.md @@ -106,8 +106,8 @@ export BOOl_VALUE="true" export INT_VALUE="1" export FLOAT_VALUE="1.1" export INVALID_MAP_VALUE="value\nkey:value" # An invalid attempt to inject a map key into the YAML -export REPLACE_ME='${DO_NOT_REPLACE_ME}' # A valid replacement text -export DO_NOT_REPLACE_ME="Never use this value" +export DO_NOT_REPLACE_ME="Never use this value" # An unused environment variable +export REPLACE_ME='${DO_NOT_REPLACE_ME}' # A valid replacement text, used verbatim, not replaced with "Never use this value" ``` ```yaml From ecb8427e99cb49765ea9fe827842939da1711b96 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 12 Mar 2024 23:04:16 +0100 Subject: [PATCH 7/7] Add CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bfb0713f4a..7e62990e374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,9 @@ release. ### SDK Configuration +- Clarify environment variable substitution is not recursive + ([#3913](https://github.com/open-telemetry/opentelemetry-specification/pull/3913)) + ### Common - Tighten stability requirements for well-known attribute values.