Conversation
Claude Code Review — Auth MiddlewareGood foundation! The middleware structure is clean and the test suite is well-organized. A few issues worth addressing before merging: Bugs / Correctness1. The function was written for endpoints like # driver_routes.py — should this be require_self_or_admin instead?
_auth: bool = Depends(require_driver_or_admin),Similarly, 2. The except HTTPException:
raise
except Exception as e:
...The same pattern exists in 3.
Security Concerns4. This endpoint's docstring says it "Gets ALL tables and their data - show everything in the database". Allowing drivers (not just admins) to hit this endpoint seems overly permissive. Please double-check this is intentional. 5. Write operations allow drivers Many mutating endpoints (create/update/delete for locations, location groups, route groups, driver history) are now gated to Minor Issues6. Wrong status code in Returning 7. Redundant token verification in The function calls Test Coverage GapsThe following new functions have no tests:
Also worth adding:
NitpickIn |
776d2ef to
12503c5
Compare
ludavidca
left a comment
There was a problem hiding this comment.
Hey James, thanks for putting this up! I've gone through and left comments throughout.
Honestly, I think a good chunk of the issues come down to me not being as clear enough in the ticket requirements. That's on me, and I want to make sure we get aligned before you spend more time on revisions.
There are also a few bugs and logic issues I flagged inline, take a look when you get a chance.
Can we grab some time to sync on this today? I want to walk through the comments together so we're on the same page about the direction, and then the fixes should be a lot more straightforward from there.
Requesting changes for now, but we'll sort it out soon :)
fdb845e to
03b0aa3
Compare
F4KRP-116
Implementation Description
require_admin,require_authorization_by_role), identity-based (require_authorization_by_user_id,require_authorization_by_email), and token extraction helpers (get_current_user_id,get_current_user_email, get_current_database_user_id).Steps to Test
What Should Reviewers Focus On?
Checklist