Open brentlaster opened 2 days ago
In models/models.go, line 74 the query depends on a user-provided value.
func ReadQuery(r string) ([]Book, error) { rows, err := DB.Query(fmt.Sprintf("SELECT * FROM books WHERE read = '%s'", r))
If a database query (such as an SQL or NoSQL query) is built from user-provided data without sufficient sanitization, a malicious user may be able to run commands that exfiltrate, tamper with, or destroy data stored in the database.
Recommendation:
Most database connector libraries offer a way of safely embedding untrusted data into a query by means of query parameters or prepared statements. Use these features rather than building queries by string concatenation.
models/models.go is using unsafe query construction. If a database query (such as an SQL or NoSQL query) is built from user-provided data without sufficient sanitization, a malicious user may be able to run commands that exfiltrate, tamper with, or destroy data stored in the database.
See comments for details.