mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +00:00
Resolve the TLS min version when is declarted in the same package but in a different file
This commit is contained in:
parent
1fbcf10e18
commit
2fad8a4193
1 changed files with 11 additions and 2 deletions
13
rules/tls.go
13
rules/tls.go
|
@ -87,8 +87,17 @@ func (t *insecureConfigTLS) processTLSConfVal(n *ast.KeyValueExpr, c *gosec.Cont
|
|||
}
|
||||
|
||||
case "MinVersion":
|
||||
if d, ok := n.Value.(*ast.Ident); ok && d.Obj != nil {
|
||||
if vs, ok := d.Obj.Decl.(*ast.ValueSpec); ok && len(vs.Values) > 0 {
|
||||
if d, ok := n.Value.(*ast.Ident); ok {
|
||||
obj := d.Obj
|
||||
if obj == nil {
|
||||
for _, f := range c.PkgFiles {
|
||||
obj = f.Scope.Lookup(d.Name)
|
||||
if obj != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if vs, ok := obj.Decl.(*ast.ValueSpec); ok && len(vs.Values) > 0 {
|
||||
if s, ok := vs.Values[0].(*ast.SelectorExpr); ok {
|
||||
x := s.X.(*ast.Ident).Name
|
||||
sel := s.Sel.Name
|
||||
|
|
Loading…
Reference in a new issue