Skip to content

Conversation

mlapaglia
Copy link
Owner

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2025

Codecov Report

❌ Patch coverage is 74.88015% with 262 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.51%. Comparing base (932cd15) to head (baf0285).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rvices/jobs/task_executors/backup_task_executor.py 71.05% 44 Missing ⚠️
.../jobs/task_executors/notification_task_executor.py 70.42% 42 Missing ⚠️
...es/jobs/task_executors/cloud_sync_task_executor.py 52.63% 36 Missing ⚠️
...ervices/jobs/task_executors/check_task_executor.py 62.96% 30 Missing ⚠️
...ervices/jobs/task_executors/prune_task_executor.py 60.00% 20 Missing ⚠️
src/borgitory/services/jobs/job_models.py 87.50% 13 Missing ⚠️
...borgitory/protocols/job_output_manager_protocol.py 55.55% 12 Missing ⚠️
...services/jobs/task_executors/hook_task_executor.py 83.09% 12 Missing ⚠️
...gitory/protocols/job_event_broadcaster_protocol.py 62.06% 11 Missing ⚠️
src/borgitory/api/repository_stats.py 33.33% 10 Missing ⚠️
... and 9 more
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     
Flag Coverage Δ
integration 32.28% <34.89%> (+1.05%) ⬆️
unit 78.51% <74.88%> (+0.60%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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
flows to this location and may be exposed to an external user.

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.

Suggested changeset 1
src/borgitory/api/repository_stats.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/borgitory/api/repository_stats.py b/src/borgitory/api/repository_stats.py
--- a/src/borgitory/api/repository_stats.py
+++ b/src/borgitory/api/repository_stats.py
@@ -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:
EOF
@@ -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:
Copilot is powered by AI and may make mistakes. Always verify output.
mlapaglia and others added 4 commits October 6, 2025 11:07
…hrough an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@mlapaglia mlapaglia merged commit d4d94fe into develop Oct 6, 2025
17 checks passed
@mlapaglia mlapaglia deleted the refactor-job-manager branch October 6, 2025 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants