← PHP / Laravel · Contents

PHP-041 / Intermediate

Storing sensitive data in plaintext in databases or logs

A02:2021 Cryptographic Failures · CWE-311 Missing Encryption of Sensitive Data

Why is this a problem?

A single DB dump exposes national ID numbers and card numbers.

How to fix it

php
$user->rrn_enc = Crypt::encryptString($request->rrn);   // Store the minimum required and display masked values

Further reading