Skip to content

Conversation

@markstory
Copy link
Member

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

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
@markstory markstory requested review from a team as code owners January 22, 2026 22:07
@linear
Copy link

linear bot commented Jan 22, 2026

@markstory markstory requested review from a team January 22, 2026 22:07
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 22, 2026
cursor[bot]

This comment was marked as outdated.

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
flows to this location and may be exposed to an external user.

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.

Suggested changeset 1
src/sentry/synapse/endpoints/org_cell_mappings.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/sentry/synapse/endpoints/org_cell_mappings.py b/src/sentry/synapse/endpoints/org_cell_mappings.py
--- a/src/sentry/synapse/endpoints/org_cell_mappings.py
+++ b/src/sentry/synapse/endpoints/org_cell_mappings.py
@@ -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:
EOF
@@ -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:
Copilot is powered by AI and may make mistakes. Always verify output.
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.

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.

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