From 55c6ceaaa6ec9323abe90bbba9fcd812da4e715d Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Tue, 9 Nov 2021 21:59:53 +0100 Subject: [PATCH] Fix crash when parsing the TLS min version value (#724) --- rules/tls.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/tls.go b/rules/tls.go index 486b56e..55a6786 100644 --- a/rules/tls.go +++ b/rules/tls.go @@ -88,7 +88,7 @@ func (t *insecureConfigTLS) processTLSConfVal(n *ast.KeyValueExpr, c *gosec.Cont case "MinVersion": if d, ok := n.Value.(*ast.Ident); ok { - if vs, ok := d.Obj.Decl.(*ast.ValueSpec); ok { + if vs, ok := d.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