-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(cells) Implement most of the org-cell-mappings endpoint #106830
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
We're moving away from sentry.api.endpoints having all the things, and towards module/app based directories.
A core feature of synapse is to route requests between cells. In order to do that routing, synapse will need to periodically fetch org mapping data allowing it to map slugs + ids to the regions. Refs INFRENG-171
| cursor=cursor, | ||
| ) | ||
| except BadPaginationError as e: | ||
| raise ParseError(detail=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 about 1 hour ago
General approach: avoid exposing the raw exception message to the client. Instead, convert BadPaginationError into a ParseError (or similar 4xx error) with a generic, client-safe message. Optionally log the original exception server-side, but do not include it in the HTTP response.
Best fix here without changing existing functionality: keep raising ParseError, but change detail=str(e) to a constant generic message like "Invalid pagination parameters.". This preserves the HTTP error type and semantics (client gave bad input) while ensuring no internal details are leaked. If desired, server-side logging of e could be added, but since no logging utilities are shown in this snippet, we will only adjust the detail string.
Concretely, in src/sentry/synapse/endpoints/org_cell_mappings.py, within the get method of OrgCellMappingsEndpoint, update the except BadPaginationError block. Replace:
except BadPaginationError as e:
raise ParseError(detail=str(e))with:
except BadPaginationError:
raise ParseError(detail="Invalid pagination parameters.")No new imports or helper methods are required.
-
Copy modified lines R47-R48
| @@ -44,8 +44,8 @@ | ||
| limit=per_page, | ||
| cursor=cursor, | ||
| ) | ||
| except BadPaginationError as e: | ||
| raise ParseError(detail=str(e)) | ||
| except BadPaginationError: | ||
| raise ParseError(detail="Invalid pagination parameters.") | ||
|
|
||
| mappings = {} | ||
| for item in pagination_result.results: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
A core feature of synapse is to route requests between cells. In order
to do that routing, synapse will need to periodically fetch org mapping
data allowing it to map slugs + ids to the regions.
Refs INFRENG-171