mirror of
https://github.com/apidoorman/doorman.git
synced 2026-02-08 18:18:46 -06:00
3.7 KiB
3.7 KiB
v1 Launch Fixes
This file tracks potential issues, impact, and suggested fixes discovered during the pre-launch review.
Auth/session + UI access
-
Cookie SameSite handling:
COOKIE_SAMESITE=Noneon HTTP drops cookies in browsers. Fix: inbackend-services/routes/authorization_routes.py, ifsamesite == 'none'and_secureis false, downgrade tolaxand log a warning. This prevents confusing login loops in dev. -
Admin UI access inconsistency: login allows “super admin” regardless of
ui_access, butAuthContextlater setshasUIAccessstrictly fromuser.ui_access. Fix: alignAuthContextto treatrole === 'admin'orusername === 'admin'as UI‑allowed (or ensure seed/restore always forcesui_access=true).
Admin/user/role management
GET /platform/user/email/{email}can 500 when user not found:UserService.get_user_by_emaildereferencesuserbefore checkingNone. Fix: checkif not userbefore accessing keys.- Admin subscription bypass is broken:
subscription_requiredcomparesusernametoDOORMAN_ADMIN_EMAIL, so admin users don’t bypass subscriptions unless username equals email. Fix: useis_admin_user(username)orusername == 'admin'(or check role). - Response schema mismatch:
GET /platform/user/email/{email}declaresresponse_model=list[UserModelResponse]but returns a single user object. Fix: adjust response_model or return list consistently. - Super admin cannot see self:
/platform/user/all,/platform/user/{username}, and/platform/user/email/{email}always hideadmin. Fix: allowadminto see self when the requester is admin (or whenusername == auth_username).
Gateway routing + subscriptions
- Subscriptions allow horizontal privilege escalation:
/platform/subscription/subscribeand/platform/subscription/unsubscribeallow any authenticated user to target any username; only group membership is checked. Fix: ifapi_data.username != actor, requiremanage_subscriptions(or admin) before proceeding. - Subscription reads lack permission checks:
/platform/subscription/subscriptions/{user_id}returns any user’s subscriptions to any authenticated caller. Fix: restrict to self or requiremanage_subscriptions. - API allowed roles are defined but never enforced on gateway requests. If roles are intended to gate API access, add a role check alongside group/subscription enforcement; otherwise clarify docs/UI to avoid false expectations.
Analytics/logs/dashboard + config/security
- Config export APIs use
cursor.to_list()on sync PyMongo cursors (backend-services/routes/config_routes.py). In Mongo mode this raisesAttributeError. Fix: replace withlist(cursor)or use async db helpers consistently. - Subscriptions available-apis uses
cursor.to_list()on sync cursor (backend-services/routes/subscription_routes.py); same issue in Mongo mode. Fix: convert to list like above or use async helper. - Dashboard data requires only auth, not
view_analytics. If analytics visibility is supposed to be permissioned, add a role check (or clarify that dashboard is always visible to UI‑access users).
Tests/smoke coverage
- No coverage for subscription permission checks (subscribe/unsubscribe another user, read others’ subscriptions). Add tests to prevent privilege escalation regressions.
- No coverage for API role enforcement on gateway access (if intended). Add a test that denies a user whose role is not in
api_allowed_roles. - No coverage for cookie SameSite/Secure behavior in HTTP dev. Add a web client smoke test or integration test that validates cookie presence after login when
HTTPS_ONLY=false. - Config export/import is only exercised in memory mode; no test for Mongo mode cursor handling. Add a small integration test or adjust code to use driver‑agnostic helper.