Detect hard-coded passwords
Hard-coded passwords are a critical security issue. When exposed, the attacker can leak data and access sensitive information.
Starting from version 2024.2, Qodana provides the HardcodedPasswords
inspection that detects hard-coded passwords and covers the following languages: JavaScript and TypeScript, Java, Kotlin, and Groovy, PHP, Golang, Python, C#, JSON, YAML, and XML.
How it works
By default, the HardcodedPasswords
inspection reports variables with values matching built-in regex rules for hard-coded passwords. To report any variable with a suspicious name like token
or password
and a constant string value, add the following configuration in the qodana.yaml
file:
You can specify your own regex rules to detect hard-coded passwords by saving them in the qodana.yaml
file, for example:
To enable your custom hard-coded password setup, save the HardcodedPasswords
configuration in the qodana.yaml
file: