Skip to content

fix(repositories): Convert repository sync api to be a control endpoint#114797

Merged
evanpurkhiser merged 1 commit into
masterfrom
danf/sync-repos-endpoint-silo-fix
May 5, 2026
Merged

fix(repositories): Convert repository sync api to be a control endpoint#114797
evanpurkhiser merged 1 commit into
masterfrom
danf/sync-repos-endpoint-silo-fix

Conversation

@wedamija
Copy link
Copy Markdown
Member

@wedamija wedamija commented May 4, 2026

This accesses a control task directly, so it has to be a control endpoint itsef.

Fixes SENTRY-5PB1

This accesses a control task directly, so it has to be a control endpoint itsef.

Fixes SENTRY-5PB1
@wedamija wedamija requested a review from evanpurkhiser May 4, 2026 22:48
@wedamija wedamija requested review from a team as code owners May 4, 2026 22:48
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 4, 2026
Comment on lines +19 to +20
@control_silo_endpoint
class OrganizationIntegrationRepoSyncEndpoint(OrganizationIntegrationBaseEndpoint):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 evanpurkhiser merged commit 2454464 into master May 5, 2026
61 of 62 checks passed
@evanpurkhiser evanpurkhiser deleted the danf/sync-repos-endpoint-silo-fix branch May 5, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants