How to hide .env passwords in Laravel whoops output?

后端 未结 10 1583
攒了一身酷
攒了一身酷 2020-12-07 10:48

How can I hide my passwords and other sensitive environment variables on-screen in Laravel\'s whoops output?

Sometimes other people are looking at my development wor

10条回答
  •  醉梦人生
    2020-12-07 11:03

    Thanks Jeff and Raheel for helping out, but I just found a little gotcha:

    Even if I clear out all environment keys from _ENV, the same keys are STILL exposed through the _SERVER variables listed.

    Adding the code below in config/app.php would hide all environment variables from the whoops page:

    'debug_blacklist' => [
            '_SERVER' => array_keys($_ENV),
            '_ENV' => array_keys($_ENV),        
    ],
    

提交回复
热议问题