The analyzer has detected a code snippet that includes internal program or server data, such as error messages, stack traces, host names, and environment variables, in the response sent to the user. An attacker can use this data to identify the application's device and prepare further attacks.
This type of vulnerability is classified as a separate risk category in the OWASP Top 10 Application Security Risks 2025: A1:2025 Broken Access Control.
The example:
func GetUser(w http.ResponseWriter, r *http.Request) {
var name string
err := db.QueryRow("SELECT name FROM users WHERE id = $1",
r.FormValue("id")).Scan(&name) // <=
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
....
}
The error that the database driver returns is passed to http.Error. Depending on the driver, the message may contain a table or column name, part of a query, the database server address, or the DBMS name.
The code can be fixed by logging the details on the server and sending a general message to the client:
func GetUser(w http.ResponseWriter, r *http.Request) {
var name string
err := db.QueryRow("SELECT name FROM users WHERE id = $1",
r.FormValue("id")).Scan(&name)
if err != nil {
log.Printf("get user: %v", err)
http.Error(w, "Internal server error", http.StatusInternalServerError)
return
}
....
}
This diagnostic rule is classified as:
Was this page helpful?