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

Security: DotEnv loads DB password plaintext in $_SERVER #1969

Closed
MGatner opened this issue Apr 23, 2019 · 5 comments
Closed

Security: DotEnv loads DB password plaintext in $_SERVER #1969

MGatner opened this issue Apr 23, 2019 · 5 comments

Comments

@MGatner
Copy link
Member

MGatner commented Apr 23, 2019

This might be considered and decided upon already, but I was surprised when I ran phpinfo() to check extensions that it includes Environment values and thus, my database password (in plaintext). Technically $_SERVER and environment variables should never be exposed, but practically there are a lot of stray calls to phpinfo() which normally isn't ideal but doesn't display anything so compromising as DB connection info.

@albertleao
Copy link

albertleao commented May 6, 2019

I've never seen this be done. It's really up to the developer to make sure there are is no phpinfo() around in the code. It's the equivalent of trying to encrypt passwords for the reason that developers have echo $my_password somewhere in the code. At the end of the day, there's only so much you can do to prevent a developer from following bad practices.

If an attacker gains access to your server, they're going to have access to your password anyways. I know AWS Encrypts DB passwords in transit when you're using KMS or Opsworks/ElasticBeanstalk, but that password is still visible if someone gets access to your apache conf files so encrypting it in codeigniter would be useless.

Most IDE's have a way to check for things like phpinfo().

@MGatner
Copy link
Member Author

MGatner commented May 7, 2019

Gotcha, I'll follow you on this and say "dev problem" - closing.

@MGatner MGatner closed this as completed May 7, 2019
@Paradinight
Copy link

@MGatner
Copy link
Member Author

MGatner commented May 7, 2019

Thanks @Paradinight - cool feature I didn't know about! I wasn't so much worried about this for myself, but generally. But if others don't think it is the framework's responsibility to keep $_SERVER clean then I won't worry about it.

@Paradinight
Copy link

We should add a info in the documentation and in the env file.

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

No branches or pull requests

3 participants