mirror of
https://github.com/securego/gosec.git
synced 2025-11-23 22:15:04 +02:00
rules(G202): detect SQL concat in ValueSpec declarations; add test sample\n\n- Handle var query string = 'SELECT ...' + user style declarations\n- Reuse existing binary expr detection on ValueSpec.Values\n- Add postgres sample mirroring issue #1309 report\n- Rules tests: 42 passed
This commit is contained in:
committed by
Cosmin Cojocar
parent
4be6b11bbc
commit
40ac53017b
@@ -191,6 +191,11 @@ func (s *sqlStrConcat) checkQuery(call *ast.CallExpr, ctx *gosec.Context) (*issu
|
||||
if injection := s.findInjectionInBranch(ctx, decl.Rhs); injection != nil {
|
||||
return ctx.NewIssue(injection, s.ID(), s.What, s.Severity, s.Confidence), nil
|
||||
}
|
||||
case *ast.ValueSpec:
|
||||
// handle: var query string = "SELECT ...'" + user
|
||||
if injection := s.findInjectionInBranch(ctx, decl.Values); injection != nil {
|
||||
return ctx.NewIssue(injection, s.ID(), s.What, s.Severity, s.Confidence), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user