Debian Codegraph @

gcc/testsuite/sarif-replay.dg/2.1.0-valid/tutorial-example.sarif

raw
1 /* Adapted from https://github.com/microsoft/sarif-tutorials
2 samples/bad-eval-with-code-flow.sarif.
3 which is licensed under the Creative Commons Attribution 4.0 International Public License
4 and/or the MIT License. */
5
6 {
7 "version": "2.1.0",
8 "runs": [
9 {
10 "tool": {
11 "driver": {
12 "name": "PythonScanner"
13 }
14 },
15 "results": [
16 {
17 "ruleId": "PY2335",
18 "message": {
19 "text": "Use of tainted variable 'raw_input' in the insecure function 'eval'."
20 },
21 "locations": [
22 {
23 "physicalLocation": {
24 "artifactLocation": {
25 "uri": "bad-eval-with-code-flow.py"
26 },
27 "region": {
28 "startLine": 10
29 }
30 }
31 }
32 ],
33 "codeFlows": [
34 {
35 "message": {
36 "text": "Tracing the path from user input to insecure usage."
37 },
38 "threadFlows": [
39 {
40 "locations": [
41 {
42 "location": {
43 "physicalLocation": {
44 "artifactLocation": {
45 "uri": "bad-eval-with-code-flow.py"
46 },
47 "region": {
48 "startLine": 5
49 }
50 }
51 },
52 "state": {
53 "expr": {
54 "text": "undef"
55 }
56 },
57 "nestingLevel": 0
58 },
59 {
60 "location": {
61 "physicalLocation": {
62 "artifactLocation": {
63 "uri": "bad-eval-with-code-flow.py"
64 },
65 "region": {
66 "startLine": 6
67 }
68 }
69 },
70 "state": {
71 "expr": {
72 "text": "42"
73 }
74 },
75 "nestingLevel": 0
76 },
77 {
78 "location": {
79 "physicalLocation": {
80 "artifactLocation": {
81 "uri": "bad-eval-with-code-flow.py"
82 },
83 "region": {
84 "startLine": 10
85 }
86 }
87 },
88 "state": {
89 "raw_input": {
90 "text": "42"
91 }
92 },
93 "nestingLevel": 1
94 }
95 ]
96 }
97 ]
98 }
99 ]
100 }
101 ]
102 }
103 ]
104 }
105
106 /* { dg-begin-multiline-output "" }
107 bad-eval-with-code-flow.py:10: warning: Use of tainted variable 'raw_input' in the insecure function 'eval'. [PY2335]
108 events 1-2
109 |
110 |
111 +--> event 3
112 |
113 |
114 { dg-end-multiline-output "" } */
115
116 // TODO: show path even when we can't find the source
117 // TODO: show path when we can find the source