How to hide .env passwords in Lumen when you leave debug as false?

心已入冬 提交于 2019-12-23 23:27:00

问题


How can I hide my passwords and other sensitive environment variables on-screen in Lumen (Not Laravel)?

Sometimes we either forget or test smth in development and make debug=false in the .env file. We maybe don't want other people to see such information even in development phase.

Also for some people who don't know this, if an exception is thrown while opening a page or making a request, everything that is in the .env file is shown in the browser, including db passwords etc - "and this is how you debug"!

I have found a solution for Laravel but I need it for Lumen also!

Solution for Laravel: How to hide .env passwords in Laravel whoops output?

It would be best if we had this as a default setting offer by Laravel team, but after some discussions in Laracast I'm not quite optimistic!

I HOPE DEVELOPERS KNOW THIS ISSUE AND BE VERY VERY CAREFUL BECAUSE FORGETTING IT OR EVEN TESTING IT IN DEVELOPMENT HAS A HUGE HUGE RISK OF BEING HACKED!

Thank You!


回答1:


you can totally customize debug output in the ÈxceptionHandler class.

its up to you, how you want the exception to be transformed into a json response



来源:https://stackoverflow.com/questions/51221713/how-to-hide-env-passwords-in-lumen-when-you-leave-debug-as-false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!