-
-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor job manager #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor job manager #126
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #126 +/- ##
===========================================
+ Coverage 77.90% 78.51% +0.60%
===========================================
Files 126 139 +13
Lines 13483 13684 +201
===========================================
+ Hits 10504 10744 +240
+ Misses 2979 2940 -39
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…orgitory into refactor-job-manager
except ValueError as e: | ||
# Handle validation errors (e.g., no archives found) | ||
return HTMLResponse( | ||
content=f"<p class='text-red-700 dark:text-red-300 text-sm text-center'>{str(e)}</p>", |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 1 day ago
To fix this information exposure issue, we should avoid displaying the stringified exception message str(e)
to the external user. Instead, provide a generic error message whenever a ValueError
occurs. The actual exception details can be logged on the server for diagnostics.
Specifically, edit lines 88–91 in src/borgitory/api/repository_stats.py
so that:
- The HTML response sent to the user contains a generic, non-specific error message.
- The details of the original exception are logged (e.g., using
logging.warning
) for developers’ reference.
No additional imports are needed, as the logging
module is already imported.
-
Copy modified lines R88-R92 -
Copy modified line R94
@@ -85,8 +85,13 @@ | ||
) | ||
except ValueError as e: | ||
# Handle validation errors (e.g., no archives found) | ||
# Log validation error details for diagnostics, return generic message to user | ||
logging.warning( | ||
"Validation error during repository statistics HTML generation (repository_id=%s): %s", | ||
repository_id, str(e) | ||
) | ||
return HTMLResponse( | ||
content=f"<p class='text-red-700 dark:text-red-300 text-sm text-center'>{str(e)}</p>", | ||
content="<p class='text-red-700 dark:text-red-300 text-sm text-center'>A validation error has occurred while generating repository statistics.</p>", | ||
status_code=400, | ||
) | ||
except Exception: |
No description provided.