Skip to content

Commit

Permalink
Merge pull request #585 from sipcapture/alert-autofix-4
Browse files Browse the repository at this point in the history
Fix code scanning alert no. 4: Database query built from user-controlled sources
  • Loading branch information
adubovikov authored Jan 7, 2025
2 parents 63f628d + a5e40a0 commit 7117a3b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions data/service/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,8 @@ func (us *UserService) IsAdmin(email string) (bool, error) {
func (us *UserService) GetUserByUUID(GUID, UserName string) ([]*model.TableUser, int, error) {

var user []*model.TableUser
var sqlWhere = make(map[string]interface{})

sqlWhere = map[string]interface{}{"username": UserName, "guid": GUID}

if err := us.Session.Debug().Table("users").Where(sqlWhere).Find(&user).Error; err != nil {
if err := us.Session.Debug().Table("users").Where("username = ? AND guid = ?", UserName, GUID).Find(&user).Error; err != nil {
return user, 0, err
}

Expand Down

0 comments on commit 7117a3b

Please sign in to comment.