Skip to content

Commit

Permalink
Merge pull request #582 from sipcapture/alert-autofix-1
Browse files Browse the repository at this point in the history
Fix code scanning alert no. 1: Database query built from user-controlled sources
  • Loading branch information
adubovikov authored Jan 7, 2025
2 parents d7e8fd6 + 55ac37f commit 607fbd1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions data/service/agentSub.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ func (hs *AgentsubService) GetAgentsubAgainstType(typeRequest string) (string, e
var AgentsubObject []model.TableAgentLocationSession
var count int

whereSQL := fmt.Sprintf("expire_date > NOW() AND type LIKE '%%%s%%'", typeRequest)

if err := hs.Session.Debug().Table("agent_location_session").
Where(whereSQL).
Where("expire_date > NOW() AND type LIKE ?", "%"+typeRequest+"%").
Find(&AgentsubObject).Count(&count).Error; err != nil {
return "", err
}
Expand Down

0 comments on commit 607fbd1

Please sign in to comment.