Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent escape '#' when generating env_file string #1114

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

alanoliveira
Copy link
Contributor

This PR prevents escape # character when generating the string used by docker --env argument.
The # was escaped because String#dump also consider ruby interpolation sequences as special characters, so a secret set as PASSWORD=foo#$123 changed to PASSWORD=foo\#$123 inside the container.

@@ -11,6 +11,16 @@ class EnvFileTest < ActiveSupport::TestCase
Kamal::EnvFile.new(env).to_s
end

test "to_s won't escape '#'" do
env = {
"foo" => "\#$foo",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change these to # instead of \#? They mean the same thing and the \ makes it seem like there's some extra escaping going on that isn't really there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

@djmb djmb merged commit 0f97e0b into basecamp:main Oct 23, 2024
8 checks passed
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.

2 participants