Skip to content

Commit

Permalink
Merge pull request ILIAS-eLearning#8711 from surlabs/trunk_LTI_019
Browse files Browse the repository at this point in the history
LTI: Added permissions checking and HTML escaping
  • Loading branch information
Saaweel authored Dec 12, 2024
2 parents dbeee9f + 2877e1d commit ed3b0cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Uri;

Expand Down Expand Up @@ -785,7 +785,7 @@ protected function confirmDeleteProviders(array $providers, string $cancelComman
$confirmationGUI->addItem(
'provider_ids[]',
(string) $provider->getId(),
$provider->getTitle(),
htmlspecialchars($provider->getTitle()),
$providerIcon
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ public static function registerClient(array $data, object $tokenObj): array
$reponseData = $data;
$provider = new ilLTIConsumeProvider();
$toolConfig = $data['https://purl.imsglobal.org/spec/lti-tool-configuration'];
$provider->setTitle($data['client_name']);
$provider->setTitle(strip_tags($data['client_name'], ilObjectGUI::ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION));
$provider->setProviderUrl($toolConfig['target_link_uri']);
$provider->setInitiateLogin($data['initiate_login_uri']);
$provider->setRedirectionUris(implode(",", $data['redirect_uris']));
Expand Down
6 changes: 3 additions & 3 deletions components/ILIAS/LTIConsumer/ltiregstart.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,13 +16,15 @@
*
*********************************************************************/

declare(strict_types=1);

/** @noRector */
chdir("../../../");

ilInitialisation::initILIAS();
global $DIC;

if (!$DIC->user()->getId() || $DIC->user()->getId() === ANONYMOUS_USER_ID) {
if (!$DIC->user()->getId() || !ilLTIConsumerAccess::hasCustomProviderCreationAccess()) {
ilObjLTIConsumer::sendResponseError(401, "unauthorized");
}

Expand Down

0 comments on commit ed3b0cc

Please sign in to comment.