Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Tarun-Chevula
Copy link
Contributor

[DRAFT PR]: Sample for azure inference core

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

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.

  1. Modify the exception handling block to log the detailed error message.
  2. Return a generic error message to the user.
Suggested changeset 1
assets/inference/environments/azurecore3.0-inference/tests/src/valid_score.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/assets/inference/environments/azurecore3.0-inference/tests/src/valid_score.py b/assets/inference/environments/azurecore3.0-inference/tests/src/valid_score.py
--- a/assets/inference/environments/azurecore3.0-inference/tests/src/valid_score.py
+++ b/assets/inference/environments/azurecore3.0-inference/tests/src/valid_score.py
@@ -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)
EOF
@@ -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)
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link

Test Results for assets-test

1 tests   0 ✅  3s ⏱️
1 suites  0 💤
1 files    1 ❌

For more details on these failures, see this check.

Results for commit 725c7b0.

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