Conversation
…rough an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves security by preventing internal error details from being exposed to API clients in the AG-UI agent endpoint.
- Changed exception handler to return a generic error message instead of exposing internal exception details
- Detailed error logging is preserved for server-side diagnostics
eavanvalkenburg
approved these changes
Nov 19, 2025
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
dmytrostruk
approved these changes
Nov 19, 2025
arisng
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 2026
* Potential fix for code scanning alert no. 18: Information exposure through an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Fix test --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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.
We should change the exception handler to log the detailed error and stack trace on the server but return only a generic error message to the API client. Specifically:
except Exception as e:block, keep the current logging statement (which safely logs full details for diagnostics).{"error": str(e)}to a generic message, such as{"error": "An internal error has occurred."}or similar wording.agent_endpointinsideadd_agent_framework_fastapi_endpointinpython/packages/ag-ui/agent_framework_ag_ui/_endpoint.pyon or around line 94.No new methods or imports are required, as
loggingis already present and providing sufficient diagnostics.Suggested fixes powered by Copilot Autofix. Review carefully before merging.