fix: close unclosed file handles in views, management commands#14446
fix: close unclosed file handles in views, management commands#14446xovishnukosuri wants to merge 1 commit intoDefectDojo:devfrom
Conversation
🔴 Risk threshold exceeded.This pull request makes edits to sensitive code paths: dojo/api_v2/views.py and dojo/engagement/views.py, which the scanner flagged as sensitive and suggests configuring allowed authors or paths in .dryrunsecurity.yaml. Reviewers should verify these changes carefully against project security policies and update .dryrunsecurity.yaml if the edits are authorized.
🔴 Configured Codepaths Edit in
|
| Vulnerability | Configured Codepaths Edit |
|---|---|
| Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml. |
🔴 Configured Codepaths Edit in dojo/engagement/views.py (drs_401040f5)
| Vulnerability | Configured Codepaths Edit |
|---|---|
| Description | Sensitive edits detected for this file. Sensitive file paths and allowed authors can be configured in .dryrunsecurity.yaml. |
We've notified @mtesauro.
Comment to provide feedback on these findings.
Report false positive: @dryrunsecurity fp [FINDING ID] [FEEDBACK]
Report low-impact: @dryrunsecurity nit [FINDING ID] [FEEDBACK]
Example: @dryrunsecurity fp drs_90eda195 This code is not user-facing
All finding details can be found in the DryRun Security Dashboard.
|
Thanks for the heads-up. These edits are limited to safe resource cleanup (closing file handles) in and while preserving existing behavior. No auth/permission logic changes. Happy to adjust if you prefer a different pattern or want these paths added to the allowlist in .dryrunsecurity.yaml. |
|
Follow-up (previous comment had a shell-escaping issue): these edits are limited to safe resource cleanup (closing file handles) in download_proof and download_risk_acceptance while preserving existing behavior. No auth/permission logic changes. Happy to adjust if you prefer a different pattern or want these paths added to the allowlist in .dryrunsecurity.yaml. |
This PR fixes resource leaks where file handles were not properly closed:
Changes ensure proper resource cleanup and prevent potential file descriptor exhaustion.