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

How to not show the Environment Variables section? #340

Closed
garygreen opened this issue Dec 1, 2015 · 17 comments
Closed

How to not show the Environment Variables section? #340

garygreen opened this issue Dec 1, 2015 · 17 comments

Comments

@garygreen
Copy link
Contributor

I would like to get rid of the environment variables section, as I find it a huge security risk if you accidentally leave debug turned on in production then the user may be able to see all passwords for your environment.

Is there an easy way to tell whoops to not render the environment vars?

@GrahamCampbell
Copy link
Contributor

GrahamCampbell commented Dec 1, 2015

@garygreen A solution to this is to not install whoops on the production server. Make it a dev-dependency.

@GrahamCampbell
Copy link
Contributor

Then, even if we leave the server in debug more by mistake, we still don't try to use whoops: https://github.com/GrahamCampbell/Laravel-Exceptions/blob/master/src/Displayers/DebugDisplayer.php#L79.

@garygreen
Copy link
Contributor Author

@GrahamCampbell that's a pretty good solution. To be fair though it would be cool if you could disable certain sections in whoops. I pretty much never use the environment vars section anyway

@garygreen
Copy link
Contributor Author

Not sure if whoops plays a role in monolog, would it report less information to e.g. bugsnag if whoops not included?

@GrahamCampbell
Copy link
Contributor

I use bugsnag through my exceptions package, so it's separate from this. :)

@denis-sokolov
Copy link
Collaborator

I have a strong position that we do not support running PrettyPageHandler in production.

If we were to implement any such filtering out features, like hiding environment variables, there would still be plenty of exposed information through the code display, stack, and whatever more.
Do not run PrettyPageHandler in production.

Wherever in your code a debug flag is set, add a safeguard instead:

if ($debug && !serverNameMatchesDev()) {
  die('Unexpected debug on production');
}

@tontonsb
Copy link

tontonsb commented Nov 5, 2018

I have the same problem but it's not production. It's just developing on virtual servers that are accessible on the internet.

Currently if I just set up an empty Laravel application with default settings (debug enabled) and it crashes, the database credentials are dumped publicly. How is that acceptable as the default behaviour?

@PieterjanDeClippel
Copy link

PieterjanDeClippel commented Dec 10, 2018

Don't bother. I asked them the same question and they immediately go to defense mode.

The only thing you can do is like this: https://github.com/PieterjanDeClippel/LaravelProjects/commit/b27549998385a351085594c79e0a3c5f32ca7103#diff-c136564e81b15005cc82fac61a00ce9f

You may try to convince them that some virus can become active inside your network, creating a connection to a remote server. Once this succeeds, it can just search for a webpage on a private server which throws a 500 error and the hacker immediately knows your password. What would be the expected response? They'll just blame you instead of tightening the security breach in the framework...

The only suggestion I can make at this point:

  1. Don't count on the goodwill of the developers and organize 2 environments (either 2 real servers where 1 is totally private and 1 is public, or 1 public server and a homestead environment)
  2. Set the configuration I embedded in my GitHub commit. It's already SOME kind of extra security...
  3. Use totally different credentials for public vs private development. Like SMTP-email address also different (how annoying would that be)

In the case of your public virtual environment, basically the only thing you can do is set the config as of in the GitHub-link mentioned above, If you're fine with hackers knowing only the length of your SQL-password.

@PieterjanDeClippel
Copy link

PieterjanDeClippel commented Dec 10, 2018

I told my collegues at work that Laravel prints passwords on a webpage and they immediately started laughing 😆

@tontonsb
Copy link

I ended up creating a package that hides variables from output - https://github.com/GlaivePro/Hidevara

@staabm
Copy link
Contributor

staabm commented Dec 10, 2018

hiding the env-information for security reasons gives you a false-sense of safety/security.

the whoops error page contains very sensitive information. in case you show it to anyone which is not a developer of the app you should consider this a security risk.

@PieterjanDeClippel
Copy link

Printing the environment variables on a HTML webpage in any fashion is a security risk...

@tontonsb
Copy link

What do you mean by "very sensitive information"? We use it because it shows the scripts where the error occured. If you refer to that information as "very sensitive", I just disagree as I don't want to hide my source.

@staabm
Copy link
Contributor

staabm commented Dec 10, 2018

most people which try to hide some information of the PrettyPageHandler pages do so, because they use it in public facing websites. Even if you hide the ENV information, the system is at risk in this case.

@PieterjanDeClippel
Copy link

I know but at least they can't hack my network from inside with a virus and immediately know my SQL-password. At least that one is obscured, wheter or not it's a different password from the one on the public server...

@bendubuisson
Copy link

Printing the environment variables on a HTML webpage in any fashion is a security risk...

It's a debugging tool...

@JohnnyWalkerDigital
Copy link

@bendubuisson Yes, but it's so useless for debugging that Ignition (the successor to the original Whoops output) doesn't do it.

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

8 participants