← PHP / Laravel · Contents

PHP-083 / Beginner

Hardcoded passwords or API keys in source code

A07:2021 Identification and Authentication Failures · CWE-798 Hard-coded Credentials

Why is this a problem?

Everyone with repository access obtains production credentials.

How to fix it

php
$client = new Stripe(['key' => config('services.stripe.secret')]);   // .env

Further reading