Usage of hard-coded MySQL database password

Description

Your code contains a hard-coded password for MySQL database connections. Storing passwords directly in code compromises security and makes your application vulnerable to unauthorized access.

Remediations

  • Do not embed passwords directly in your code. This practice is insecure and exposes your database to potential breaches.
  • Do use environment variables to store sensitive information such as database passwords. This method keeps credentials out of your codebase and makes them easier to manage securely.
  • Do consider implementing a key-management system to securely handle passwords and other sensitive information. This approach provides enhanced security measures for managing and accessing credentials.

References

Associated CWE

OWASP Top 10

Configuration

To skip this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --skip-rule=go_lang_hardcoded_mysql_database_password

To run only this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --only-rule=go_lang_hardcoded_mysql_database_password