Skip to content

Conversation

@djmb
Copy link
Collaborator

@djmb djmb commented Dec 1, 2025

Docker env files normally pass the output of key=value pairs 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

Docker env files normally pass the output of `key=value` pairs 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 asis 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Secret that stores a JSON value being set in a way that causes JSON::ParserError in app

2 participants