Skip to content

Security: enforce teacher-student enrollment check on student tracking page#8602

Merged
AngelFQC merged 1 commit into
masterfrom
security/auto-fix-GHSA-rp64-899j-x9f6
Jun 19, 2026
Merged

Security: enforce teacher-student enrollment check on student tracking page#8602
AngelFQC merged 1 commit into
masterfrom
security/auto-fix-GHSA-rp64-899j-x9f6

Conversation

@AngelFQC

Copy link
Copy Markdown
Member

Problem

my_space/myStudents.php authorized access to a student's full tracking profile (quiz scores, LP progress, time-on-task, last login, personal details) based only on the requester holding a tracking-capable role. Because api_is_teacher() (and other course-scoped roles) short-circuit the access flag to true, and the target student id comes straight from the student query parameter, any teacher on the platform could read the learning records of any student — regardless of whether they share a course — by enumerating the student parameter.

Fix

Add a per-student authorization layer right after the target user is resolved, in addition to the existing role gate:

  • Teachers / course admins must have a real instructional relationship with the target student — either sharing a course (UserManager::isTeacherOfStudent(), which intersects the teacher's taught courses with the student's enrolled courses) or being allowed to coach them in a session (Tracking::is_allowed_to_coach_student()).
  • Platform admins, session admins, HR managers (DRH) and student bosses are exempt and keep their existing platform-/cohort-wide tracking scope.

This mirrors the access rule already used in public/main/lp/lp_tracking.php.

Invariant now enforced

A teacher can only open the tracking profile of a student they actually teach or coach; requests for unrelated student ids are rejected with api_not_allowed().

Notes for the reviewer

  • UserManager::isTeacherOfStudent() compares base-course enrollments. A student enrolled in the teacher's course only through a session is covered by the Tracking::is_allowed_to_coach_student() branch (session coach relationship). If a deployment relies on base-course teachers tracking session-only students without a coach relationship, that edge case should be reviewed — the same limitation already exists in lp_tracking.php, whose pattern is replicated here for consistency.
  • The existing $allowedToTrackUser role logic is left untouched; this change only adds a second, stricter gate.

OWASP control

A01:2021 – Broken Access Control (CWE-639, Authorization Bypass Through User-Controlled Key / IDOR).

Refs GHSA-rp64-899j-x9f6

🤖 Generated with Claude Code

@AngelFQC AngelFQC force-pushed the security/auto-fix-GHSA-rp64-899j-x9f6 branch from c8c5235 to 4081740 Compare June 16, 2026 13:18
myStudents.php granted access to a student's full tracking profile to any
user holding a tracking-capable role (notably any teacher, via
api_is_teacher()) without checking that the requester actually teaches the
target student, so a teacher could read the learning records of any student
on the platform by changing the `student` query parameter.

Replace the three overlapping role checks (the broad $allowedToTrackUser OR,
the current-course relationship block, and the extra per-student guard) with
a single two-level rule:

1. Wide scope (platform/session admins, HR managers, student bosses) may view
   any student's tracking.
2. Everyone else needs a real relationship with the target student: teaches
   them (UserManager::isTeacherOfStudent, shared course), coaches them
   (Tracking::is_allowed_to_coach_student, shared session), or tutors a course
   the student is enrolled in (get_tutor_in_course_status + enrollment check).

Course tutors keep access, but only to students enrolled in the course they
tutor, instead of to any student as the previous check allowed.

Refs GHSA-rp64-899j-x9f6

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AngelFQC AngelFQC force-pushed the security/auto-fix-GHSA-rp64-899j-x9f6 branch from 4081740 to 73b01e3 Compare June 16, 2026 13:23
@AngelFQC AngelFQC merged commit c6bc500 into master Jun 19, 2026
1 of 12 checks passed
@AngelFQC AngelFQC deleted the security/auto-fix-GHSA-rp64-899j-x9f6 branch June 19, 2026 23:49
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