Skip to content

Conversation

@leeandher
Copy link
Member

@leeandher leeandher commented Nov 6, 2025

Adds a feature flag to limit the access to the new endpoints.

Also checking the existing flag for access to the create/update endpoints, but not for get/delete (so that users who downgrade can delete their configs if they wish)

@leeandher leeandher requested review from a team as code owners November 6, 2025 16:18
@leeandher leeandher requested a review from liuirene256 November 6, 2025 16:18
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 6, 2025
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Feature flag check before database query to prevent disclosure

Feature flag check happens after database query in convert_args(). The convert_args() method fetches the DataForwarder object from the database before the feature flag is checked in the put() and delete() methods. This allows users without the feature flag to probe whether specific data forwarder IDs exist in an organization by observing different HTTP status codes (404 for non-existent vs 403 for feature disabled). The feature flag check should be moved to convert_args() before the database query to prevent this information disclosure.

src/sentry/integrations/api/endpoints/data_forwarding_details.py#L67-L85

"PUT": ApiPublishStatus.EXPERIMENTAL,
"DELETE": ApiPublishStatus.EXPERIMENTAL,
}
permission_classes = (OrganizationDataForwardingDetailsPermission,)
def convert_args(
self,
request: Request,
organization_id_or_slug: int | str,
data_forwarder_id: int,
*args,
**kwargs,
):
args, kwargs = super().convert_args(request, organization_id_or_slug, *args, **kwargs)
try:
data_forwarder = DataForwarder.objects.get(
id=data_forwarder_id,
organization=kwargs["organization"],

Fix in Cursor Fix in Web


@leeandher
Copy link
Member Author

Bug: Feature flag check before database query to prevent disclosure

Feature flag check happens after database query in convert_args(). The convert_args() method fetches the DataForwarder object from the database before the feature flag is checked in the put() and delete() methods. This allows users without the feature flag to probe whether specific data forwarder IDs exist in an organization by observing different HTTP status codes (404 for non-existent vs 403 for feature disabled). The feature flag check should be moved to convert_args() before the database query to prevent this information disclosure.

src/sentry/integrations/api/endpoints/data_forwarding_details.py#L67-L85

Fix in Cursor Fix in Web

clever, thanks cursor

@leeandher leeandher merged commit f4c6956 into master Nov 6, 2025
66 checks passed
@leeandher leeandher deleted the leander/data-forwarding-flag branch November 6, 2025 17:43
Ahmed-Labs pushed a commit that referenced this pull request Nov 6, 2025
Adds a feature flag to limit the access to the new endpoints.

Also checking the existing flag for access to the create/update
endpoints, but not for get/delete (so that users who downgrade can
delete their configs if they wish)
Jesse-Box pushed a commit that referenced this pull request Nov 12, 2025
Adds a feature flag to limit the access to the new endpoints.

Also checking the existing flag for access to the create/update
endpoints, but not for get/delete (so that users who downgrade can
delete their configs if they wish)
andrewshie-sentry pushed a commit that referenced this pull request Nov 13, 2025
Adds a feature flag to limit the access to the new endpoints.

Also checking the existing flag for access to the create/update
endpoints, but not for get/delete (so that users who downgrade can
delete their configs if they wish)
@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants