Why it matters
Anyone who can read the repository can sign in to the database.
How to fix it
Read the password from the environment (getenv) or a secret store, and rotate the password that was committed.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
<?php
$pdo = new PDO("mysql:host=db.internal;dbname=shop", "shop", "Sup3rS3cret!");<?php
$pdo = new PDO(getenv("DB_DSN"), getenv("DB_USER"), getenv("DB_PASSWORD"));What TrustIvan reads
Runs on repository scans of PHP source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- Extract request data (PHP)
PHPSeverity: High
trustivan-php-extract-request-data - JWT hardcoded secret (PHP)
PHPSeverity: High
trustivan-php-jwt-hardcoded-secret - XXE libxml NOENT (PHP)
PHPSeverity: High
trustivan-php-xxe-libxml-noent - Laravel CSRF except all (PHP)
PHPSeverity: Medium
trustivan-php-laravel-csrf-except-all - Unserialize without allowed classes (PHP)
PHPSeverity: Medium
trustivan-php-unserialize-without-allowed-classes - Phpinfo call (PHP)
PHPSeverity: Medium
trustivan-php-phpinfo-call
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation