This repository was archived by the owner on Sep 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 641
sec(authz): addresses authorization bypass and information disclosure issues #6155
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses critical authorization bypass and information disclosure vulnerabilities in the Dispatch application. The fixes implement a "default deny" security approach to prevent unauthorized access to restricted incidents and cases, while also securing user enumeration endpoints.
- Replaces vulnerable role-based filtering logic that allowed bypass for users with null or unhandled roles
- Implements proper access control for individual user endpoints to prevent unauthorized user enumeration
- Adds comprehensive test coverage to verify security fixes work correctly across all role scenarios
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/dispatch/database/service.py | Core security fixes - implements default deny approach for incident/case filtering and removes debug output |
| src/dispatch/auth/views.py | Secures individual user endpoint with proper permission dependency |
| tests/database/test_service.py | Adds comprehensive security-focused test coverage for filtering functions |
| tests/static/e2e/pages/auth-page.ts | Enhances E2E test reliability with better error handling and retry logic |
| pyproject.toml | Updates Ruff configuration structure for newer versions |
| playwright.config.ts | Improves CI environment navigation timeout handling |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Marc Vilanova <39573146+mvilanova@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Marc Vilanova <39573146+mvilanova@users.noreply.github.com>
Signed-off-by: Marc Vilanova <39573146+mvilanova@users.noreply.github.com>
whitdog47
approved these changes
Jul 29, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
I have successfully implemented the security fixes for the critical access control vulnerability identified. Here's a comprehensive overview of the changes made:
🔒 Critical Security Fixes Implemented
1. Fixed
restricted_incident_filterFunctionFile:
src/dispatch/database/service.py(lines 809-826)Previous vulnerability: Only applied restrictions if
role == UserRoles.member, allowing bypass for users withNoneroles or any unhandled roles.Fix implemented:
UserRoles.admin,UserRoles.owner, andUserRoles.managerget unrestricted accessUserRoles.member,None, and any unhandled roles) now have restrictive filters appliedjointoouterjoinwith explicitIndividualContact.id == Participant.individual_contact_idto handle cases where users aren't participants2. Fixed
restricted_case_filterFunctionFile:
src/dispatch/database/service.py(lines 841-858)Applied identical security fixes as the incident filter:
3. Secured Individual User Endpoint
File:
src/dispatch/auth/views.py(lines 125-140)Previous vulnerability:
GET /{organization}/users/{user_id}had no access control, allowing unauthorized user enumeration.Fix implemented:
OrganizationMemberPermissionGET /{organization}/users)🧪 Comprehensive Test Coverage
File:
tests/database/test_service.pyAdded security-focused tests to verify:
owner,manager,admin) have unrestricted accessNoneroles) have restrictive filters applied🛡️ Security Impact
Before the fix:
role: null(non-members) could access ALL restricted incidents/cases across ANY organizationAfter the fix:
🔍 Technical Details
Key Changes:
admin,owner,manager)outerjoinwith explicit foreign key relationshipsVisibility.openvsVisibility.restrictedThe fixes maintain backward compatibility while closing the critical security vulnerability.