-
Notifications
You must be signed in to change notification settings - Fork 138
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
[DRAFT PR]: Sample for azure inference core #3881
base: main
Are you sure you want to change the base?
Conversation
except Exception as e: | ||
error = str(e) | ||
|
||
return AMLResponse({'error': error}, 500, json_str=True) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium test
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 12 days ago
To fix the problem, we should avoid sending detailed error messages to the user. Instead, we should log the detailed error message on the server and return a generic error message to the user. This approach ensures that sensitive information is not exposed while still allowing developers to debug issues using the server logs.
- Modify the exception handling block to log the detailed error message.
- Return a generic error message to the user.
-
Copy modified lines R32-R35
@@ -31,4 +31,5 @@ | ||
except Exception as e: | ||
error = str(e) | ||
|
||
return AMLResponse({'error': error}, 500, json_str=True) | ||
import traceback | ||
error_details = traceback.format_exc() | ||
print(f"Error occurred: {error_details}") | ||
return AMLResponse({'error': 'An internal error has occurred.'}, 500, json_str=True) |
Test Results for assets-test1 tests 0 ✅ 3s ⏱️ For more details on these failures, see this check. Results for commit 725c7b0. |
[DRAFT PR]: Sample for azure inference core