Skip to content

Security P4 — Overrides: derive tutor identity from JWT + relationship checks #64

Description

@franciszver

Part of #59.

Part of the broken-access-control remediation epic. Depends on Phase 1. This is the only write-side identity-trust finding — highest integrity risk.

Findings addressed

Work

  • Derive tutor_id from the authenticated JWT (current_user → DB user); ignore/validate any body-supplied tutor_id.
  • Validate student_id and target_id against a TutorStudentAssignment (src/models/tutor_student.py) before mutating Summary/PracticeAssignment or committing the Override.
  • Apply the same relationship check to the GET history route.

Definition of Done

  • override.tutor_id always equals the authenticated caller.
  • Mutations rejected (403) when the caller has no assignment to the target student.
  • GET history returns 403 for unrelated tutors; owner/admin works.

Affected files

src/api/handlers/overrides.py, src/models/tutor_student.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions