File tree Expand file tree Collapse file tree 3 files changed +90
-0
lines changed Expand file tree Collapse file tree 3 files changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ id : missing-ssl-minversion-go
2
+ language : go
3
+ severity : warning
4
+ message : >-
5
+ MinVersion` is missing from this TLS configuration. By default, TLS
6
+ 1.2 is currently used as the minimum when acting as a client, and TLS 1.0
7
+ when acting as a server. General purpose web applications should default
8
+ to TLS 1.3 with all other protocols disabled. Only where it is known that
9
+ a web server must support legacy clients with unsupported an insecure
10
+ browsers (such as Internet Explorer 10), it may be necessary to enable TLS
11
+ 1.0 to provide support. Add `MinVersion: tls.VersionTLS13' to the TLS
12
+ configuration to bump the minimum version to TLS 1.3.
13
+ note : >-
14
+ [CWE-327]: Use of a Broken or Risky Cryptographic Algorithm
15
+ [OWASP A03:2017]: Sensitive Data Exposure
16
+ [OWASP A02:2021]: Cryptographic Failures
17
+ [REFERENCES]
18
+ https://owasp.org/Top10/A02_2021-Cryptographic_Failures
19
+
20
+ ast-grep-essentials : true
21
+
22
+ utils :
23
+ match_tls_without_minversion :
24
+ kind : composite_literal
25
+ all :
26
+ - has :
27
+ kind : qualified_type
28
+ all :
29
+ - has :
30
+ kind : package_identifier
31
+ regex : " ^tls$"
32
+ - has :
33
+ kind : type_identifier
34
+ field : name
35
+ regex : " ^Config$"
36
+ - has :
37
+ kind : literal_value
38
+ not :
39
+ has :
40
+ kind : keyed_element
41
+ all :
42
+ - has :
43
+ kind : literal_element
44
+ regex : ^MinVersion$
45
+ - has :
46
+ pattern : $A
47
+ rule :
48
+ any :
49
+ - matches : match_tls_without_minversion
50
+
Original file line number Diff line number Diff line change
1
+ id : missing-ssl-minversion-go
2
+ snapshots :
3
+ ? |
4
+ server.TLS = &tls.Config{ Rand : zeroSource{}, }
5
+ : labels :
6
+ - source : ' tls.Config{ Rand: zeroSource{}, }'
7
+ style : primary
8
+ start : 14
9
+ end : 47
10
+ - source : tls
11
+ style : secondary
12
+ start : 14
13
+ end : 17
14
+ - source : Config
15
+ style : secondary
16
+ start : 18
17
+ end : 24
18
+ - source : tls.Config
19
+ style : secondary
20
+ start : 14
21
+ end : 24
22
+ - source : ' { Rand: zeroSource{}, }'
23
+ style : secondary
24
+ start : 24
25
+ end : 47
Original file line number Diff line number Diff line change
1
+ id : missing-ssl-minversion-go
2
+ valid :
3
+ - |
4
+ TLSClientConfig: &tls.Config{
5
+ KeyLogWriter: w,
6
+ MinVersion: tls.VersionSSL30,
7
+ Rand: zeroSource{},
8
+ InsecureSkipVerify: true,
9
+ },
10
+
11
+ invalid :
12
+ - |
13
+ server.TLS = &tls.Config{ Rand: zeroSource{}, }
14
+
15
+
You can’t perform that action at this time.
0 commit comments