fix(security): IDOR in PromptsActivityEndpoint GET - scope project by organization#104990
fix(security): IDOR in PromptsActivityEndpoint GET - scope project by organization#104990
Conversation
… organization The GET endpoint accepted project_id in query params but didn't validate it belonged to the organization, allowing users to potentially query prompt activity data using project IDs from other organizations. Added organization scoping check to the GET method (PUT was already fixed in PR #104920) and a regression test for the GET endpoint.
markstory
left a comment
There was a problem hiding this comment.
Looks good to me other than the endpoint parameter consistency.
cc33971 to
3f06a93
Compare
5fb220b to
3f06a93
Compare
5e62ac4 to
3f06a93
Compare
|
this one is... for some reason, taking a lot of intervention on the agent. def woulda been faster to fix by hand (tho the agent did a great job finding it) |
419f4a6 to
ab78a16
Compare
Follow-up neededThe
This is harmless but redundant. We should follow up to remove |
- Add organization parameter to method signatures for consistency - Remove redundant organization_id query param from GET (use URL org) - Fix fail-open pattern by removing conditional organization check - Add empty string validation for project_id - Update tests to reflect new behavior
ab78a16 to
2b88bec
Compare
Additional follow-up: Split test classesThe test file
This matches the pattern used elsewhere (e.g., |
The GET endpoint now uses the organization from the URL path, making the organization_id query parameter redundant. Also adds explicit error handling when organization is null in promptsCheck(). Follow-up to #104990.
Splits the single test class into GetPromptsActivityTest and PutPromptsActivityTest with a shared base class, matching the pattern used elsewhere (e.g., test_organization_search_details.py). Follow-up to #104990.
Splits the single test class into GetPromptsActivityTest and PutPromptsActivityTest with a shared base class, matching the pattern used elsewhere (e.g., test_organization_search_details.py). Follow-up to getsentry#104990.
…106414) Splits the single `PromptsActivityTest` class into separate test classes per HTTP method, following the pattern used elsewhere (e.g., `test_organization_search_details.py`). Structure: - `PromptsActivityTestBase` - shared setUp logic - `GetPromptsActivityTest` - GET endpoint tests (2 tests) - `PutPromptsActivityTest` - PUT endpoint tests (13 tests) This addresses pre-existing technical debt, not introduced by the original PR. Follow-up to #104990.
…106414) Splits the single `PromptsActivityTest` class into separate test classes per HTTP method, following the pattern used elsewhere (e.g., `test_organization_search_details.py`). Structure: - `PromptsActivityTestBase` - shared setUp logic - `GetPromptsActivityTest` - GET endpoint tests (2 tests) - `PutPromptsActivityTest` - PUT endpoint tests (13 tests) This addresses pre-existing technical debt, not introduced by the original PR. Follow-up to #104990.
The GET endpoint now uses the organization from the URL path, making the organization_id query parameter redundant. Also adds explicit error handling when organization is null in promptsCheck(). Follow-up to #104990.
…106413) Removes the redundant `organization_id` query parameter from the frontend prompts API calls. The GET endpoint now uses the organization from the URL path (after the fix in #104990), making this parameter ignored but harmless. Changes: - Remove `organization_id` from `promptsCheck()`, `makePromptsCheckQueryKey()`, and `batchedPromptsCheck()` - Add explicit error handling in `promptsCheck()` when organization is null (previously would create an invalid URL `/organizations/undefined/...`) Follow-up to #104990. --------- Co-authored-by: Jay Goss <jaygoss@gmail.com>
Summary
Fixes IDOR vulnerability in
PromptsActivityEndpoint.get()whereproject_idquery parameter was not validated against the organization, allowing users to potentially query prompt activity data using project IDs from other organizations.Note: The PUT endpoint was already fixed in PR #104920, but the GET endpoint was missed.
Changes
project_idin the GET methodtest_idor_get_project_from_different_orgTest plan