fix: restore authorization checks and default-deny filtering#48
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
fix: restore authorization checks and default-deny filtering#48devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Restores the Netflix#6155 authz fixes that were reverted: - auth/views.py: re-add OrganizationMemberPermission on GET /users/{id} - database/service.py: restore default-deny in restricted_incident_filter and restricted_case_filter (admin/owner/manager bypass, outerjoin for visibility, and_(restricted, participant) guard) - database/service.py: apply model-specific filters directly instead of via intersect (fixes sort-after-filter) - database/service.py: remove debug print statement 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
eval-bug-1commit reverted the authz hardening from Netflix#6155. This caused three test failures:test_sorting_functionality—search_filter_sort_paginateusedintersect(query_restricted)for every Incident/Case query, which broke ordering and returned empty results for non-member roles.test_restricted_incident_filter_with_test_data/test_restricted_case_filter_with_test_data—restricted_*_filterusedjoininstead ofouterjoin, dropping open incidents/cases without participants; also missing the admin/owner/manager early-return bypass and theand_(visibility == restricted, email == …)guard.Fixes:
auth/views.py: Re-addOrganizationMemberPermissiondependency onGET /users/{user_id}.database/service.py:restricted_incident_filter/restricted_case_filter: restore default-deny (admin bypass →return query.distinct();outerjoin;and_(restricted, participant)guard).search_filter_sort_paginate: applyapply_model_specific_filtersdirectly toqueryinstead of viaintersect; keepintersectonly fortag_all_filters.printinapply_filter_specific_joins.Link to Devin session: https://app.devin.ai/sessions/dc26ce1ba40040018ef8f1190e36e3df