File tree 3 files changed +119
-0
lines changed
3 files changed +119
-0
lines changed Original file line number Diff line number Diff line change
1
+ id : openai-empty-secret-go
2
+ language : go
3
+ severity : warning
4
+ message : >-
5
+ The application uses an empty credential. This can lead to unauthorized
6
+ access by either an internal or external malicious actor. It is
7
+ recommended to rotate the secret and retrieve them from a secure secret
8
+ vault or Hardware Security Module (HSM), alternatively environment
9
+ variables can be used if allowed by your company policy.
10
+ note : >-
11
+ [CWE-287] Improper Authentication.
12
+ [REFERENCES]
13
+ - https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures
14
+ utils :
15
+ MATCH_openai.NewClient :
16
+ kind : expression_list
17
+ all :
18
+ - has :
19
+ stopBy : neighbor
20
+ kind : call_expression
21
+ all :
22
+ - has :
23
+ stopBy : neighbor
24
+ kind : selector_expression
25
+ all :
26
+ - has :
27
+ stopBy : neighbor
28
+ kind : identifier
29
+ regex : " ^openai$"
30
+ - has :
31
+ stopBy : neighbor
32
+ kind : field_identifier
33
+ regex : " ^NewClient$"
34
+ - has :
35
+ stopBy : neighbor
36
+ kind : argument_list
37
+ regex : \(\s*\"\"\s*\)
38
+ - inside :
39
+ stopBy : end
40
+ kind : function_declaration
41
+ follows :
42
+ stopBy : end
43
+ kind : import_declaration
44
+ has :
45
+ stopBy : end
46
+ kind : import_spec
47
+ regex : " github.com/sashabaranov/go-openai"
48
+ rule :
49
+ kind : expression_list
50
+ matches : MATCH_openai.NewClient
Original file line number Diff line number Diff line change
1
+ id : openai-empty-secret-go
2
+ snapshots :
3
+ ? |
4
+ import (
5
+ " github.com/sashabaranov/go-openai"
6
+ )
7
+ func main() {
8
+ client := openai.NewClient("")
9
+ }
10
+ : labels :
11
+ - source : openai.NewClient("")
12
+ style : primary
13
+ start : 72
14
+ end : 92
15
+ - source : openai
16
+ style : secondary
17
+ start : 72
18
+ end : 78
19
+ - source : NewClient
20
+ style : secondary
21
+ start : 79
22
+ end : 88
23
+ - source : openai.NewClient
24
+ style : secondary
25
+ start : 72
26
+ end : 88
27
+ - source : ("")
28
+ style : secondary
29
+ start : 88
30
+ end : 92
31
+ - source : openai.NewClient("")
32
+ style : secondary
33
+ start : 72
34
+ end : 92
35
+ - source : ' "github.com/sashabaranov/go-openai"'
36
+ style : secondary
37
+ start : 9
38
+ end : 44
39
+ - source : |-
40
+ import (
41
+ "github.com/sashabaranov/go-openai"
42
+ )
43
+ style: secondary
44
+ start: 0
45
+ end: 46
46
+ - source : |-
47
+ func main() {
48
+ client := openai.NewClient("")
49
+ }
50
+ style: secondary
51
+ start: 47
52
+ end: 97
Original file line number Diff line number Diff line change
1
+ id : openai-empty-secret-go
2
+ valid :
3
+ - |
4
+ import (
5
+ "github.com/sashabaranov/go-openai"
6
+ )
7
+ func main() {
8
+ client := openai.NewClient("fvgf")
9
+ }
10
+ invalid :
11
+ - |
12
+ import (
13
+ "github.com/sashabaranov/go-openai"
14
+ )
15
+ func main() {
16
+ client := openai.NewClient("")
17
+ }
You can’t perform that action at this time.
0 commit comments