Skip to content

fix: restore authorization checks and default-deny filtering#48

Open
devin-ai-integration[bot] wants to merge 1 commit into
eval-bug-1from
devin/1781286364-fix-authz-regression
Open

fix: restore authorization checks and default-deny filtering#48
devin-ai-integration[bot] wants to merge 1 commit into
eval-bug-1from
devin/1781286364-fix-authz-regression

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The eval-bug-1 commit reverted the authz hardening from Netflix#6155. This caused three test failures:

  1. test_sorting_functionalitysearch_filter_sort_paginate used intersect(query_restricted) for every Incident/Case query, which broke ordering and returned empty results for non-member roles.
  2. test_restricted_incident_filter_with_test_data / test_restricted_case_filter_with_test_datarestricted_*_filter used join instead of outerjoin, dropping open incidents/cases without participants; also missing the admin/owner/manager early-return bypass and the and_(visibility == restricted, email == …) guard.

Fixes:

  • auth/views.py: Re-add OrganizationMemberPermission dependency on GET /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: apply apply_model_specific_filters directly to query instead of via intersect; keep intersect only for tag_all_filters.
    • Remove debug print in apply_filter_specific_joins.

Link to Devin session: https://app.devin.ai/sessions/dc26ce1ba40040018ef8f1190e36e3df

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>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants