Skip to content

Commit 6b41557

Browse files
committed
pySCG: update KNOWN_ISSUES with inlined code mismatches
Update generate_issue_report.py to detect and report inlined code mismatches. Regenerated KNOWN_ISSUES.md showing 18 files where README inlined code doesn't match actual Python files. Signed-off-by: tommcd <[email protected]>
1 parent 34447b3 commit 6b41557

File tree

2 files changed

+60
-9
lines changed

2 files changed

+60
-9
lines changed

docs/Secure-Coding-Guide-for-Python/KNOWN_ISSUES.md

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ ISSUES FOUND
33

44
Documentation Issues:
55

6+
CWE-664/CWE-134/README.md
7+
-> Inlined code doesn't match file content
8+
69
CWE-664/CWE-197/01/README.md
710
-> E Missing required sections: Bibliography
811

912
CWE-664/CWE-197/README.md
1013
-> E Missing required sections: Bibliography
1114
-> Section order issue
1215

16+
CWE-664/CWE-209/README.md
17+
-> Inlined code doesn't match file content
18+
1319
CWE-664/CWE-400/README.md
1420
-> E Missing required sections: Automated Detection
1521

@@ -25,9 +31,11 @@ Documentation Issues:
2531

2632
CWE-664/CWE-459/README.md
2733
-> E Missing required sections: Bibliography
34+
-> Inlined code doesn't match file content
2835

2936
CWE-664/CWE-460/README.md
3037
-> E Missing required sections: Bibliography
38+
-> Inlined code doesn't match file content
3139

3240
CWE-664/CWE-501/README.md
3341
-> E Missing required sections: Non-Compliant Code Example, Compliant Solution
@@ -40,6 +48,9 @@ Documentation Issues:
4048
-> E Missing required sections: Bibliography
4149
-> Section order issue
4250

51+
CWE-664/CWE-584/README.md
52+
-> Inlined code doesn't match file content
53+
4354
CWE-664/CWE-665/README.md
4455
-> E Missing required sections: Automated Detection, Bibliography
4556

@@ -51,17 +62,30 @@ Documentation Issues:
5162
-> E Missing required sections: Bibliography
5263
-> Section order issue
5364

65+
CWE-664/CWE-843/README.md
66+
-> Inlined code doesn't match file content
67+
5468
CWE-682/CWE-1335/01/README.md
5569
-> E Missing required sections: Bibliography
5670
-> Section order issue
5771

72+
CWE-682/CWE-1335/README.md
73+
-> Inlined code doesn't match file content
74+
5875
CWE-682/CWE-191/README.md
5976
-> E Missing required sections: Automated Detection
6077
-> Section order issue
78+
-> Inlined code doesn't match file content
79+
80+
CWE-691/CWE-362/README.md
81+
-> Inlined code doesn't match file content
6182

6283
CWE-693/CWE-182/README.md
6384
-> E Missing required sections: Non-Compliant Code Example, Compliant Solution
6485

86+
CWE-693/CWE-184/README.md
87+
-> Inlined code doesn't match file content
88+
6589
CWE-693/CWE-330/README.md
6690
-> E Missing required sections: Compliant Solution, Bibliography
6791

@@ -71,8 +95,15 @@ Documentation Issues:
7195
CWE-693/CWE-778/README.md
7296
-> E Missing required sections: Bibliography
7397

98+
CWE-693/CWE-798/README.md
99+
-> Inlined code doesn't match file content
100+
101+
CWE-703/CWE-230/README.md
102+
-> Inlined code doesn't match file content
103+
74104
CWE-703/CWE-252/README.md
75105
-> Section order issue
106+
-> Inlined code doesn't match file content
76107

77108
CWE-703/CWE-390/README.md
78109
-> E Missing required sections: Compliant Solution, Bibliography
@@ -93,18 +124,28 @@ Documentation Issues:
93124

94125
CWE-707/CWE-117/README.md
95126
-> E Missing required sections: Non-Compliant Code Example
127+
-> Inlined code doesn't match file content
96128

97129
CWE-707/CWE-175/README.md
98130
-> Section order issue
131+
-> Inlined code doesn't match file content
132+
133+
CWE-707/CWE-78/README.md
134+
-> Inlined code doesn't match file content
135+
136+
CWE-707/CWE-838/README.md
137+
-> Inlined code doesn't match file content
99138

100139
CWE-710/CWE-1109/README.md
101140
-> Section order issue
141+
-> Inlined code doesn't match file content
102142

103143
CWE-710/CWE-489/README.md
104144
-> E Missing required sections: Non-Compliant Code Example, Compliant Solution
105145

106146
Intro_to_multiprocessing_and_multithreading/README.md
107147
-> E Missing required sections: Non-Compliant Code Example, Compliant Solution, Automated Detection, Related Guidelines
148+
-> Inlined code doesn't match file content
108149

109150
Python Code Issues:
110151

@@ -138,17 +179,11 @@ Python Code Issues:
138179
CWE-682/CWE-1335/noncompliant01.py
139180
-> Execution timeout (intentional infinite loop/blocking)
140181

141-
CWE-693/CWE-798/compliant01.py
142-
-> DeprecationWarning detected
143-
144-
CWE-703/CWE-390/compliant01.py
145-
-> Execution timeout (intentional infinite loop/blocking)
146-
147-
CWE-703/CWE-390/noncompliant01.py
182+
CWE-691/CWE-366/compliant01.py
148183
-> Execution timeout (intentional infinite loop/blocking)
149184

150185
======================================================================
151-
Total Files with Issues: 44
186+
Total Files with Issues: 53
152187

153188
For detailed output: uv run pytest tests/ -v
154-
For fix instructions: see tests/README.md
189+
For fix instructions: see tests/README.md

docs/Secure-Coding-Guide-for-Python/tests/generate_issue_report.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ def parse_test_output(output):
7575
elif "Section order issues:" in lines[j]:
7676
error_msg = "Section order issue"
7777
break
78+
elif "Inlined code mismatches:" in lines[j]:
79+
# Extract which files have mismatches
80+
k = j + 1
81+
inlined_files = []
82+
while k < len(lines) and k < j + 20:
83+
if lines[k].strip().startswith("- ") and ".py:" in lines[k]:
84+
# Extract filename
85+
file_match = re.search(r'- ([^:]+\.py):', lines[k])
86+
if file_match:
87+
inlined_files.append(file_match.group(1))
88+
k += 1
89+
if inlined_files:
90+
error_msg = f"Inlined code mismatch: {', '.join(inlined_files)}"
91+
else:
92+
error_msg = "Inlined code doesn't match file content"
93+
break
7894
j += 1
7995

8096
if not error_msg:

0 commit comments

Comments
 (0)