Skip to content

Commit 26e39f0

Browse files
authored
Update ssl-verify-none-rust.yml
1 parent 2eb9f4b commit 26e39f0

File tree

1 file changed

+40
-23
lines changed

1 file changed

+40
-23
lines changed

rules/rust/security/ssl-verify-none-rust.yml

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ message: >-
66
note: >-
77
[CWE-295]: Improper Certificate Validation
88
[REFERENCES]
9-
- https://docs.rs/openssl/latest/openssl/ssl/struct.SslContextBuilder.html#method.set_verify
10-
9+
- https://docs.rs/openssl/latest/openssl/ssl/struct.SslContextBuilder.html#method.set_verify
1110
rule:
1211
kind: call_expression
1312
any:
@@ -21,13 +20,18 @@ rule:
2120
- pattern: use openssl;
2221
- pattern: use openssl::ssl;
2322
- pattern: use openssl::ssl::SSL_VERIFY_NONE;
24-
- has:
25-
stopBy: end
26-
kind: use_list
27-
has:
28-
stopBy: end
29-
kind: identifier
30-
pattern: SSL_VERIFY_NONE
23+
- all:
24+
- has:
25+
stopBy: end
26+
kind: use_list
27+
has:
28+
stopBy: end
29+
kind: identifier
30+
regex: ^SSL_VERIFY_NONE$
31+
- has:
32+
stopBy: end
33+
kind: scoped_identifier
34+
regex: ^openssl::ssl$
3135
- pattern: $BUILDER.set_verify(ssl::SSL_VERIFY_NONE)
3236
inside:
3337
stopBy: end
@@ -37,13 +41,18 @@ rule:
3741
any:
3842
- pattern: use openssl::ssl;
3943
- pattern: use openssl::ssl::SSL_VERIFY_NONE;
40-
- has:
41-
stopBy: end
42-
kind: use_list
43-
has:
44-
stopBy: end
45-
kind: identifier
46-
pattern: SSL_VERIFY_NONE
44+
- all:
45+
- has:
46+
stopBy: end
47+
kind: use_list
48+
has:
49+
stopBy: end
50+
kind: identifier
51+
regex: ^SSL_VERIFY_NONE$
52+
- has:
53+
stopBy: end
54+
kind: scoped_identifier
55+
regex: ^openssl::ssl$
4756
- pattern: $BUILDER.set_verify(SSL_VERIFY_NONE)
4857
inside:
4958
stopBy: end
@@ -54,13 +63,19 @@ rule:
5463
- pattern: use openssl;
5564
- pattern: use openssl::ssl;
5665
- pattern: use openssl::ssl::SSL_VERIFY_NONE;
57-
- has:
58-
stopBy: end
59-
kind: use_list
60-
has:
61-
stopBy: end
62-
kind: identifier
63-
pattern: SSL_VERIFY_NONE
66+
- all:
67+
- has:
68+
stopBy: end
69+
kind: use_list
70+
has:
71+
stopBy: end
72+
kind: identifier
73+
regex: ^SSL_VERIFY_NONE$
74+
- has:
75+
stopBy: end
76+
kind: scoped_identifier
77+
regex: ^openssl::ssl$
78+
6479
- pattern: $BUILDER.set_verify($ALIAS)
6580
inside:
6681
stopBy: end
@@ -84,4 +99,6 @@ rule:
8499
kind: identifier
85100
field: alias
86101
pattern: $ALIAS
102+
87103
- pattern: $BUILDER.set_verify(openssl::ssl::SSL_VERIFY_NONE);
104+

0 commit comments

Comments
 (0)