diff --git a/CHANGELOG.md b/CHANGELOG.md index 17e53055328..a254eb0a637 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,9 @@ release. ### SDK Configuration +- Clarify environment variable substitution is not recursive + ([#3913](https://github.com/open-telemetry/opentelemetry-specification/pull/3913)) + ### Common ### Supplementary Guidelines diff --git a/specification/configuration/file-configuration.md b/specification/configuration/file-configuration.md index b530ee73ab1..6e75166befc 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 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 @@ -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 +recursive_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 +recursive_key: ${DO_NOT_REPLACE_ME} # Interpreted as type string, tag URI tag:yaml.org,2002:str ``` ## SDK Configuration