fix(repositories): Convert repository sync api to be a control endpoint#114797
Merged
Conversation
This accesses a control task directly, so it has to be a control endpoint itsef. Fixes SENTRY-5PB1
Comment on lines
+19
to
+20
| @control_silo_endpoint | ||
| class OrganizationIntegrationRepoSyncEndpoint(OrganizationIntegrationBaseEndpoint): |
Contributor
There was a problem hiding this comment.
Bug: A non-numeric integration_id in the URL will cause a 500 error due to missing input validation from the new base class.
Severity: MEDIUM
Suggested Fix
Re-implement the input validation for integration_id. Override the convert_args method in the endpoint to safely cast the integration_id to an integer, raising an Http404 if a ValueError occurs, mirroring the behavior of the previous base class.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location:
src/sentry/integrations/api/endpoints/organization_integration_repo_sync.py#L19-L20
Potential issue: Changing the base class to `OrganizationIntegrationBaseEndpoint`
removed the input validation for the `integration_id` URL parameter. Previously,
`convert_args` would safely cast the ID to an integer and raise an `Http404` on failure.
Now, if a non-numeric string is passed as `integration_id`, it is sent directly to the
database query `objects.get(id=integration_id)`. This causes the ORM to raise an
unhandled `ValueError`, resulting in a 500 Internal Server Error instead of a 404 Not
Found.
Did we get this right? 👍 / 👎 to inform future reviews.
evanpurkhiser
approved these changes
May 5, 2026
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.
This accesses a control task directly, so it has to be a control endpoint itsef.
Fixes SENTRY-5PB1