Skip to content

fix: Information exposure through an exception - #153

Merged
agslima merged 2 commits into
mainfrom
alert-autofix-7
Jul 21, 2026
Merged

fix: Information exposure through an exception#153
agslima merged 2 commits into
mainfrom
alert-autofix-7

Conversation

@agslima

@agslima agslima commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/agslima/csv-schema-evolution/security/code-scanning/7

Use generic, non-sensitive error details in API responses, and log full exception details server-side.

Best fix in this file:

  1. Add a module logger (import logging + logger = logging.getLogger(__name__)).
  2. In both except Exception as exc blocks (Mongo ping and GridFS probe), replace detail: str(exc) with a generic message (for example, "dependency check failed").
  3. Log the exception with stack trace using logger.exception(...) so operators keep diagnostics without exposing internals to clients.

Edits are confined to backend/app/api/v1/endpoints/health.py in:

  • import/header region
  • the two except blocks in readiness_check

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Agnaldo Silva Lima <a.agnaldosilva@gmail.com>

@agslima agslima left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go

@agslima
agslima marked this pull request as ready for review July 21, 2026 20:40
@agslima
agslima enabled auto-merge (squash) July 21, 2026 20:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: beb06458b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread backend/app/api/v1/endpoints/health.py
@agslima agslima changed the title Potential fix for code scanning alert no. 7: Information exposure through an exception fix: Information exposure through an exception Jul 21, 2026
@agslima
agslima merged commit f221468 into main Jul 21, 2026
8 checks passed
@agslima
agslima deleted the alert-autofix-7 branch July 21, 2026 20:51
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.

1 participant