Commit fb4ab0a
Fix: Temporary file cleanup security vulnerability (#67)
* Fix temporary file cleanup security issue
This commit addresses a critical security vulnerability where temporary files created during multipart form parsing were not properly cleaned up from disk, potentially leading to:
- Information disclosure of sensitive uploaded data
- Disk space exhaustion from accumulated temp files
- File descriptor leaks in error scenarios
Changes:
- Added filePath field to preProcessor struct to track temp file location
- Modified preProcessor.Close() to explicitly remove temp files using os.Remove()
- Ensured both file handle closure and file deletion with proper error handling
The existing defer hsc.Close() in Parse() ensures cleanup even on errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* remove filepath field
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 222638d commit fb4ab0a
1 file changed
+14
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
223 | 236 | | |
224 | 237 | | |
225 | 238 | | |
| |||
0 commit comments