Skip to content

Commit e99f664

Browse files
CarlSchwanbackportbot[bot]
authored andcommitted
fix: Prevent error page to display arbitrary error messages
fix: Prevent error page to display arbitrary error messages Signed-off-by: Carl Schwan <carlschwan@kde.org> [skip ci]
1 parent 6b2e3cd commit e99f664

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/AppInfo/Application.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace OCA\User_SAML\AppInfo;
1111

1212
use OC\Security\CSRF\CsrfTokenManager;
13+
use OC\User\DisabledUserException;
1314
use OC\User\LoginException;
1415
use OC_User;
1516
use OCA\DAV\Events\SabrePluginAddEvent;
@@ -128,12 +129,14 @@ public function boot(IBootContext $context): void {
128129
if ($request->getPathInfo() === '/apps/user_saml/saml/error') {
129130
return;
130131
}
132+
/** @psalm-suppress UndefinedClass */
131133
$targetUrl = $urlGenerator->linkToRouteAbsolute(
132134
'user_saml.SAML.genericError',
133135
[
134-
'message' => $e->getMessage()
136+
'reason' => $e instanceof DisabledUserException ? 'userDisabled' : 'authFailed',
135137
]
136138
);
139+
$logger->error('Login failure', ['exception' => $e]);
137140
header('Location: ' . $targetUrl);
138141
exit();
139142
}
@@ -151,7 +154,7 @@ public function boot(IBootContext $context): void {
151154
$targetUrl = $urlGenerator->linkToRouteAbsolute(
152155
'user_saml.SAML.genericError',
153156
[
154-
'message' => $l10n->t('This user account is disabled, please contact your administrator.')
157+
'reason' => 'userDisabled',
155158
]
156159
);
157160
header('Location: ' . $targetUrl);

0 commit comments

Comments
 (0)