You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security: requireCourseReadAccess grants any authenticated user course read access #154
requireCourseReadAccess() in the MCP tool provider performs no real per-course authorization. After rejecting anonymous/empty-UID callers it ends with a tautological return $userId !== '', so any authenticated (non-empty-UID) user passes the course read-access gate regardless of enrolment or role.
Callers: gate is checked at lines ~227 (listCourses) and ~351 (getCourseDetails) via if ($this->requireCourseReadAccess() === false) { ... }
Observed behavior
privatefunctionrequireCourseReadAccess(): bool
{
$user = $this->userSession->getUser();
if ($user === null) {
returnfalse;
}
$userId = $user->getUID();
if ($userId === '') {
returnfalse;
}
if ($this->groupManager->isAdmin($userId) === true) {
returntrue;
}
// Authenticated non-admin user: allowed at the provider boundary;// OpenRegister RBAC inside ObjectService scopes the actual rows.return$userId !== '';
}//end requireCourseReadAccess()
The final return $userId !== '' is always true at that point (an empty $userId already returned false above), so it is a no-op gate.
Impact
OWASP A01:2021 broken access control. The MCP tools listCourses and getCourseDetails expose course data to any authenticated user, independent of enrolment or role. The inline comment relies on OpenRegister RBAC inside ObjectService to scope rows, but the provider-level gate itself enforces nothing beyond "is logged in".
Suggested fix
Replace the tautology with a real per-course access check — e.g. an enrolment lookup or course-role lookup for the resolved $userId — or, if row-level RBAC truly is the intended boundary, rename/repurpose the method and document that it is only an authentication check (not authorization), and confirm the downstream ObjectService calls actually scope by user.
Activity