Repository navigation
Potential fix for code scanning alert no. 61: Information exposure through an exception - #126
Merged
Merged
Conversation
…rough an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Owner
Author
|
@copilot Fix Docker Image CI / build (pull_request) in this PR also |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the settings API error-sanitization change.
No open issues 🎉
What changed in this PR
This PR addresses code-scanning alert #61 by sanitizing data-update errors returned by the settings API.
Changes:
- Replaces a truthy
dataUpdateStatus.errorwith a generic message. - Copies the status before sanitizing it, preserving the original object and other status fields.
| File | Description |
|---|---|
simple_org_chart/app_main.py |
Sanitizes data-update error details in the settings GET response. |
Review effort: Balanced
Co-authored-by: dvir001 <39403717+dvir001@users.noreply.github.com>
Contributor
Fixed by pinning Pillow to 12.3.0, which supports the Docker image’s Python 3.10 runtime. The local Docker image build succeeds. Commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/dvir001/Simple-Org-Chart/security/code-scanning/61
Best practice is to keep detailed exception info in server logs only, and return sanitized/generic status to clients. Here, the safest minimal fix is in
simple_org_chart/app_main.pywhere the API response is assembled: before returningsettings, copy and sanitizedataUpdateStatusso anyerrorfield is replaced with a generic message.Single best fix without changing core functionality:
handle_settings()GET branch (around lines 996–1000), stop assigningload_data_update_status()directly into response.error, replace that field with a generic string like"An internal error occurred during data update.".settings['dataUpdateStatus'].This preserves endpoint behavior and status structure while preventing exception detail disclosure.
Suggested fixes powered by Copilot Autofix. Review carefully before merging.