fix: restore authorization checks reverted from #6155#2
Closed
devin-ai-integration[bot] wants to merge 1 commit into
Closed
fix: restore authorization checks reverted from #6155#2devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Restore OrganizationMemberPermission on GET /users/{user_id}
- Apply model-specific filters directly to query instead of using intersect
- Restore admin/owner/manager bypass in restricted_incident_filter and
restricted_case_filter (default-deny approach for all other roles)
- Use outerjoin instead of join so open entities without participants are
still visible to members
- Add Visibility.restricted guard in the and_ clause for participant checks
- Remove stray debug print() in apply_filter_specific_joins
Co-Authored-By: bot_apk <apk@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The seeded bug reverted the authz hardening from PR Netflix#6155, causing test failures in
tests/database/test_service.py. The revert introduced three classes of regressions:Missing permission guard on
GET /users/{user_id}— theOrganizationMemberPermissiondependency was stripped, making the endpoint publicly accessible to any authenticated user regardless of org membership.Broken role-based filtering in
restricted_incident_filter/restricted_case_filter— the reverted code only applied filtering forrole == memberand usedjoin(inner) instead ofouterjoin, which excluded open incidents/cases that had no participants at all. The fix restores:admin/owner/manager(unrestricted access)outerjoin+or_(open, restricted AND participant_email)for all other rolesVisibility.restrictedguard in theand_()clausesearch_filter_sort_paginateusedintersectwith a stalequery_restrictedinstead of applying model-specific filters directly toquery, which broke ordering and pagination. Also removed a strayprint()inapply_filter_specific_joins.Link to Devin session: https://app.devin.ai/sessions/6c1453e8f2f64370902940df8a6c0573