-
Notifications
You must be signed in to change notification settings - Fork 51
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
Try to get admin_password
from the ENV by default
#261
Try to get admin_password
from the ENV by default
#261
Conversation
56dfb56
to
cf3ba9c
Compare
In a situation where you run wp-cli with `--admin-password`, then plain-text password is exposed in process list (e.g. `ps aufx`). We might be able to use `--admin-password=$WP_CLI_CORE_INSTALL_ADMIN_PASSWORD`, but it's not possible also when running in a nested mode (e.g. unshare() -> chroot() -> execvp() chain). Thus, this relaxes a bit the installation and tries to get the default password from the environment itself by default. It doesn't break a current functionality. ``` % export WP_CLI_CORE_INSTALL_ADMIN_PASSWORD=password123 ; ./vendor/bin/wp core install --admin_user=admin --url=donatas.net --title=wp [email protected] Success: WordPress installed successfully. % ./vendor/bin/wp user check-password admin password123 && echo OK OK ``` Signed-off-by: Donatas Abraitis <[email protected]>
cf3ba9c
to
a8308bb
Compare
Hi there and thanks for your contribution! Can you please share some additional context on this particular PR? At first glance I don't think it makes sense to support this as-is. Usually, if you want to use a custom default value for an argument like that, the way to do itis via a If that doesn't solve your use case, for example if you'd like the config file to read from an environment variable or something, I'd suggest first opening an issue outlining your problem, what you have tried so far, and a possible solution. |
@ton31337 You can achieve a similar result with the Including
You can then pipe the value to the command:
Would this serve your needs? |
@danielbachhuber thanks for the response, but my case is a bit different. STDIN, neither file works for me, because with STDIN the password is visible in the process list (e.g. |
@ton31337 I'd rather not scatter more environment variables throughout the codebase if possible. Are there any other implementations you can think of? |
Nope, this is the most proper way achieving what's desired. If you have any other idea, let me know. |
@ton31337 This is just one of many places where directly passing sensitive information can be leaked into the process list or similar, so adding environment variables for these is not really scalable. As @danielbachhuber mentioned, WP-CLI supports file-based approaches to solve this in a more generic way:
More detailed documentation about: |
I'm closing this PR, as this will not be merged as-is, and I will copy the comment above to the issue so we can continue the discussion there to see if this adequately solves your use case. |
No description provided.