Commit 9812cf0
security: Fix top 5 low severity vulnerabilities from Snyk scan
- Fix file handle management in common/log.cpp: Properly set file pointer
to NULL after closing and add error handling for failed fopen()
(CWE-772: Missing Release of Resource after Effective Lifetime)
- Deprecate SHA1 in favor of SHA256 in gguf_hash.py: Reorder output to
prioritize SHA256 and mark SHA1 as deprecated in output messages
(CWE-327: Use of a Broken or Risky Cryptographic Algorithm)
- Remove hardcoded API keys in test_chat_completion.py: Replace all
hardcoded 'dummy' API keys with environment variable LLAMA_SERVER_TEST_API_KEY
with 'dummy' as default fallback for test environments
(CWE-798: Use of Hard-coded Credentials)
These fixes address security issues identified by Snyk static analysis:
- 4 instances of file handle leaks
- 3 instances of insecure hash usage
- 10 instances of hardcoded credentials in test code
All changes maintain backward compatibility and existing functionality.
Co-Authored-By: Jake Cosme <[email protected]>1 parent 661ae31 commit 9812cf0
File tree
3 files changed
+17
-12
lines changed- common
- gguf-py/gguf/scripts
- tools/server/tests/unit
3 files changed
+17
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| 300 | + | |
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
303 | 304 | | |
304 | | - | |
305 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
306 | 308 | | |
307 | 309 | | |
308 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 68 | | |
73 | 69 | | |
74 | 70 | | |
75 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
| 83 | + | |
85 | 84 | | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
103 | | - | |
| 106 | + | |
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| |||
293 | 296 | | |
294 | 297 | | |
295 | 298 | | |
296 | | - | |
| 299 | + | |
297 | 300 | | |
298 | 301 | | |
299 | 302 | | |
| |||
320 | 323 | | |
321 | 324 | | |
322 | 325 | | |
323 | | - | |
| 326 | + | |
324 | 327 | | |
325 | 328 | | |
326 | 329 | | |
| |||
371 | 374 | | |
372 | 375 | | |
373 | 376 | | |
374 | | - | |
| 377 | + | |
375 | 378 | | |
376 | 379 | | |
377 | 380 | | |
| |||
0 commit comments