How to hide .env passwords in Laravel whoops output?

后端 未结 10 1640
攒了一身酷
攒了一身酷 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:15

    First of all, love the solution by Jeff above.

    2nd, if like me you wanna hide all the env variables while still use whoops, here is a solution:

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

    Output:

    EDIT:

    1. Legend has it that since laravel 7x you would need debug_hide key instead
    2. If you want to hide session and cookies in Ignition (as newer versions of laravel use flare/ignition for errors), use this: Laravel / Ignition: How to hide Session info from Request Tab?

提交回复
热议问题