Don't escape Docker env file values #1728
Open
+11
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Docker env files normally pass the output of
key=valuepairs verbatim, so they don't need escaping.But they also don't support literal newlines or null bytes.
Right now we escape the values, so that we can send the values through, but then you need to unescape them in your code.
It would be preferrable to send the values as is and raise if they contain a literal \n or \0. That way there's no unexpected escaping and the user is made aware of unsupported values.
As a workaround for the two unsupported values, you could base64 encode and then decode again in the docker entrypoint script.
This change will need to wait for a major version bump though as there are likely users depending on the current escaping behavior and silently changing it could break things.
Fixes: #1412