Skip to content

Security fixes nov 26 - #190

Open
chgad wants to merge 48 commits into
developfrom
security-fixes-nov-26
Open

chgad wants to merge 48 commits into
developfrom
security-fixes-nov-26

Conversation

@chgad

@chgad chgad commented Nov 25, 2026

Copy link
Copy Markdown
Contributor
  • Role guards built by one factory (build_current_role_retrival), plus get_current_clerk_or_student. Token validation is split so each failure returns the right status code
    (401/403).
  • A malformed Authorization header returns 400 instead of 500.
  • Removed the debug and test endpoints, including the unauthenticated PATCH /test.
  • Auth no longer creates Employee or StudentDocuments rows; /employees/me and /documents get-or-create them instead.
  • security.py no longer imports handlers.
  • permission_test.py: every route must have its expected role guard.
  • Prev-employment routes (proof upload, PATCH, DELETE) are guarded and check ownership via get_prev_employment_handler.
  • get_specified_* loaders check ownership (can_access) and return 404 to non-owners; clerks bypass the check.
  • Role guard is the first route parameter, so a wrong role gets 403 before the ownership 404.
  • Approver signature is bound to budget_position_id; routes are now /approver/{budget_position_id}/{signature}.
  • Fast-track acceptance-link mail disabled for now (TODO).
  • Tests: test_security.py, ownership_check_test.py, permission_test.py, get-or-create tests, shared as_<role>_payload fixtures.

chgad added 30 commits November 23, 2026 12:07
…lizing authentication. This breaks automatic Employee and Documents creation on first login for students.
…n we therefore implement a get_or_create patern for the employee detail endpoint.
…nt. The reintroduces Employee table access to create StudentDocuments.
…udget_position_id to ensure that only the respective budget_position and the related petition can be accessed.
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.

1 participant