Skip to content

feat(supergroups): add group id to supergroup lookup endpoint#111265

Merged
cvxluo merged 3 commits intomasterfrom
cvxluo/add-by-group-endpoint-for-group-id-supergroup-look
Mar 23, 2026
Merged

feat(supergroups): add group id to supergroup lookup endpoint#111265
cvxluo merged 3 commits intomasterfrom
cvxluo/add-by-group-endpoint-for-group-id-supergroup-look

Conversation

@cvxluo
Copy link
Copy Markdown
Contributor

@cvxluo cvxluo commented Mar 20, 2026

New endpoint similar to the other supergroup ones to specifically fetch supergroups by a list of group ids.

@github-actions github-actions bot added Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components labels Mar 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@cvxluo cvxluo marked this pull request as ready for review March 23, 2026 17:22
@cvxluo cvxluo requested review from a team as code owners March 23, 2026 17:22
Comment thread src/sentry/seer/supergroups/endpoints/organization_supergroups_by_group.py Outdated
Comment thread src/sentry/api/urls.py
r"^(?P<organization_id_or_slug>[^/]+)/seer/supergroups/by-group/$",
OrganizationSupergroupsByGroupEndpoint.as_view(),
name="sentry-api-0-organization-supergroups-by-group",
),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i don't think the IDOR is correct since the risk is that someone can craft a query that access groups outside of their organization. but they can't do that because the endpoint takes the organization auth token, so they'd have to already have access to the other organization. since group ids are unique across organizations, they couldn't query using their organization + another organization's group ids, since that combination would never be valid.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you're checking that they have access to this organization but you aren't checking they have access to the group ids being passed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah i see — i think it wouldn't matter, since we filter in seer by org + group_id. i'll add a check here just in case

status=response.status,
)

return Response(orjson.loads(response.data))
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.

Unhandled JSONDecodeError when parsing Seer API response

The orjson.loads(response.data) call at line 84 does not catch JSONDecodeError. Other Seer API handlers in the codebase explicitly handle this exception because Seer can return HTML error pages instead of JSON even with non-4xx status codes. If Seer returns invalid JSON (e.g., an HTML error page or truncated response), this endpoint will raise an unhandled exception and return a 500 error to the user.

Verification

Read src/sentry/seer/similarity/similar_issues.py which shows JSONDecodeError handling with comment 'caused by Seer erroring out and sending back the error page HTML'. Also verified multiple other Seer API handlers (compare.py, get_historical_anomalies.py, store_data.py, autofix/utils.py) all wrap JSON parsing in try/except JSONDecodeError. The existing organization_supergroups.py has the same gap.

Identified by Warden sentry-backend-bugs · A79-VL7

@cvxluo cvxluo force-pushed the cvxluo/add-by-group-endpoint-for-group-id-supergroup-look branch from 009d2c8 to bad40dd Compare March 23, 2026 20:54
@cvxluo cvxluo merged commit 62f05be into master Mar 23, 2026
66 of 68 checks passed
@cvxluo cvxluo deleted the cvxluo/add-by-group-endpoint-for-group-id-supergroup-look branch March 23, 2026 21:33
scttcper added a commit that referenced this pull request Mar 23, 2026
Switch from the general supergroups endpoint with a query string to
the new dedicated by-group endpoint that accepts group_id params
directly. This aligns with the backend endpoint added in #111265.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2026
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 Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants