Skip to content

fix(authz): restore default-deny permission filters and fix intersect ordering#97

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

fix(authz): restore default-deny permission filters and fix intersect ordering#97
devin-ai-integration[bot] wants to merge 1 commit into
eval-bug-1from
devin/1781290673-fix-authz-regression

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Restores the authorization hardening from Netflix#6155 that was reverted in e3d93a6. Three interrelated bugs:

  1. restricted_incident_filter / restricted_case_filter only gated on role == member (inner join), meaning open items without participants were invisible and non-member/non-admin roles got no restriction at all. Fixed to default-deny with outerjoin:

    if role in [UserRoles.admin, UserRoles.owner, UserRoles.manager]:
        return query.distinct()
    # all other roles: outerjoin Participant → IndividualContact, filter open OR (restricted AND user is participant)
  2. search_filter_sort_paginate stored the restricted query in query_restricted then used query.intersect(query_restricted), which destroyed sort ordering. Fixed by applying apply_model_specific_filters directly to query.

  3. GET /users/{user_id} lost its OrganizationMemberPermission dependency — restored.

Also removed a stray debug print() in apply_filter_specific_joins.

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

… ordering

Restores the authorization fix from Netflix#6155 that was inadvertently reverted:

- Restore OrganizationMemberPermission on GET /users/{user_id} endpoint
- Use outerjoin in restricted_incident_filter and restricted_case_filter so
  open incidents/cases without participants remain visible
- Apply default-deny: only admin/owner/manager get unrestricted access;
  all other roles see open items + restricted items where they participate
- Apply model-specific filters directly to the query instead of using
  intersect, which was causing sort ordering to be lost
- Remove debug print statement from apply_filter_specific_joins

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