Skip to content

Should log file contain plain text database username passwords etc? #1542

Closed
@daljit3

Description

@daljit3

name: Bug report
about: Help us improve the framework by reporting bugs!


Database credentials in the log file in production mode

I have enabled logs for critical errors and I can see this information in my log files

CRITICAL - 2018-11-26 00:05:13 --> MySQL server has gone away
#0 /var/www/myproject/system/Database/MySQLi/Connection.php(177): mysqli->real_connect('my_database_host', 'my_database', 'my_password', 'my_database', 3306, '', 0)
#1 /var/www/myproject/system/Database/BaseConnection.php(369): CodeIgniter\Database\MySQLi\Connection->connect(false)
#2 /var/www/myproject/system/Database/BaseConnection.php(602): CodeIgniter\Database\BaseConnection->initialize()
#3 /var/www/myproject/application/Models/MydbModel.php(297): CodeIgniter\Database\BaseConnection->query('\r\n          SEL...')
#4 /var/www/myproject/application/Controllers/Home.php(95): App\Models\MydbModel->getCategoryData(Array)
#5 /var/www/myproject/system/CodeIgniter.php(810): App\Controllers\Home->category()
#6 /var/www/myproject/system/CodeIgniter.php(307): CodeIgniter\CodeIgniter->runController(Object(App\Controllers\Home))
#7 /var/www/myproject/system/CodeIgniter.php(221): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#8 /var/www/myproject/public/index.php(45): CodeIgniter\CodeIgniter->run()

Obviously I have replaced the above with dummy values but I am just wondering if log file should include information set by .env file? Having this information is useful, I suppose, to know which server it is trying to connect to and failing but I wanted to inform you about this.

CodeIgniter 4 version
CodeIgniter-4-develop

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions