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

Environment variables need to be escaped #488

Closed
jeaye opened this issue Aug 23, 2018 · 4 comments
Closed

Environment variables need to be escaped #488

jeaye opened this issue Aug 23, 2018 · 4 comments
Labels

Comments

@jeaye
Copy link

jeaye commented Aug 23, 2018

Variables like POSTGRES_PASSWORD may contain ' or $, which will cause bash to intercept them and open the door to errors. This is an injection problem, yes, but it's also just a convenience problem. Lots of secure (randomly generated) passphrases use quotes and dollar signs.

database_1   | 2018-08-23 20:20:50.925 UTC [66] ERROR:  unrecognized role option "fun" at character 52
database_1   | 2018-08-23 20:20:50.925 UTC [66] STATEMENT:  CREATE USER "zulip" WITH SUPERUSER PASSWORD 'zulip'fun' ;
database_1   | ERROR:  unrecognized role option "fun"
database_1   | LINE 1: CREATE USER "zulip" WITH SUPERUSER PASSWORD 'zulip'fun' ;
database_1   |                                                            ^

This issue originally comes from zulip/docker-zulip#143 (comment)

@wglambert
Copy link

Similar MariaDB/mariadb-docker#183

@tianon
Copy link
Member

tianon commented Aug 24, 2018

I thought this would have a similarly sad ending like that discussion, but it turns out that psql has functionality which makes this really trivial for us to implement!

https://stackoverflow.com/a/18683163/433558
https://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-VARIABLES
https://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-INTERPOLATION

@tianon
Copy link
Member

tianon commented Aug 24, 2018

#489 👍

@jeaye
Copy link
Author

jeaye commented Aug 24, 2018

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants