-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref(issues): Move project codeowners endpoints and tests to issues folder #97434
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
base: master
Are you sure you want to change the base?
Conversation
"schema": validated_data, | ||
} | ||
except ValidationError as e: | ||
raise serializers.ValidationError(str(e)) |
Check warning
Code scanning / CodeQL
Information exposure through an exception Medium
Stack trace information
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 days ago
To fix the problem, we should avoid exposing the string representation of the caught ValidationError
to the user. Instead, we should return a generic error message that does not reveal internal details. At the same time, we should log the exception (including the stack trace) for debugging purposes, so that developers can still investigate the root cause. This can be done by using sentry_sdk.capture_exception(e)
(already imported and used elsewhere in the file) to log the exception, and then raising a serializers.ValidationError
with a generic message such as "Invalid codeowners syntax" or "An internal error occurred while validating codeowners".
What to change:
- In the
except ValidationError as e:
block (lines 89-91), callsentry_sdk.capture_exception(e)
to log the exception. - Raise a
serializers.ValidationError
with a generic message instead ofstr(e)
.
No new imports or method definitions are needed, as sentry_sdk
is already imported.
-
Copy modified lines R90-R91
@@ -89,3 +89,4 @@ | ||
except ValidationError as e: | ||
raise serializers.ValidationError(str(e)) | ||
sentry_sdk.capture_exception(e) | ||
raise serializers.ValidationError("Invalid CODEOWNERS syntax or associations.") | ||
|
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
part of https://linear.app/getsentry/issue/RTC-1110/move-issues-endpoints-into-issues-app