Skip to content

Add certificate access protection #3536

@Bavarianspirit

Description

@Bavarianspirit

Any user who is logged in can explore all other users certificates simply by
altering the parameter id in the url.

Given the user has id 4, the url reads:
https://myhostname/certificates/index.php?id=4

Changing the id to any other valid user id will show another users
certificate, if it exists:
https://myhostname/certificates/index.php?id=5

This is a huge privacy issue as it may reveal names and other personal user
data that is included in the other users certificates.
As a workaround I suggest to add the following check to
/certificates/index.php somewhere below the lines

$certificate = new Certificate($certificateId, $userId);
$certificateData = $certificate->get($certificateId);
if (empty($certificateData)) {
api_not_allowed(false,
Display::return_message(get_lang('NoCertificateAvailable'), 'warning'));
}
// BEGIN WORKAROUND
if ( api_get_user_id() != $certificate->user_id ) {
    api_not_allowed(true);
    }
// END WORKAROUND

Beeing a workaround, this will even prevent admins or course admins from
viewing students certificates.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions