Skip to content

Fix: Make exp claim required for back-channel logout#1441

Merged
julien-nc merged 2 commits into
nextcloud:mainfrom
Spitfireap:fix/make-exp-claim-req-blo
May 19, 2026
Merged

Fix: Make exp claim required for back-channel logout#1441
julien-nc merged 2 commits into
nextcloud:mainfrom
Spitfireap:fix/make-exp-claim-req-blo

Conversation

@Spitfireap
Copy link
Copy Markdown
Contributor

fixes #1436

This reverts commit 7fcb03d.

The exp claim in the logout token during back-channel logout was not checked due to LemonLDAP (third party IdP) not including it. LemonLDAP's users would have been unable to logout with back-channel.

Now that the fix is merged, the commit can be reverted.

This reverts commit 7fcb03d.

Signed-off-by: Spitap <dev@asdrip.fr>
@Spitfireap Spitfireap changed the title Fix: Make exp claim required for back -hannel logout Fix: Make exp claim required for back-channel logout May 18, 2026
Copy link
Copy Markdown
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment thread lib/Controller/LoginController.php Outdated
}

if (isset($logoutTokenPayload->exp) && $logoutTokenPayload->exp < $this->timeFactory->getTime()) {
if ($logoutTokenPayload->exp < $this->timeFactory->getTime()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($logoutTokenPayload->exp < $this->timeFactory->getTime()) {
if (($logoutTokenPayload->exp ?? 0) < $this->timeFactory->getTime()) {

Let's handle the case where it is not defined to avoid unpredictable behaviours.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's handle the case where it is not defined to avoid unpredictable behaviours.

Ok, wouldn't it be better to catch null values here ?
Or is it a failsafe for clarity and robustness against later development ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you wish. My goal was to keep the code short.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be me, but I fail to see any scenario where this might change the result of the comparison. I'd be glad if you had time to explain it :).
Anyway, done

Copy link
Copy Markdown
Member

@julien-nc julien-nc May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the exp attribute is not defined then we use 0 so we know the comparison with getTime will fail so we actually require this attribute. Am I missing something?

Your initial version might have had the exact same behaviour but is less explicit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the exp attribute is not defined then we use 0 so we know the comparison with getTime will fail so we actually require this attribute. Am I missing something?

Your initial version might have had the exact same behaviour but is less explicit.

For me it cannot be undefined because it is checked at line 892 ($requiredClaims) and it will return (l.901) before if missing (undefined).
Worse case scenario is that it is null or empty string but the int casting will make it 0.

Signed-off-by: Spitap <dev@asdrip.fr>
@julien-nc julien-nc merged commit 1393a85 into nextcloud:main May 19, 2026
51 checks passed
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.

Backchannel logout missing exp claim check

2 participants