Repository navigation
feat(webhook_listeners): make failed login events webhook compatible - #65930
Open
6801318d8d wants to merge 1 commit into
Open
6801318d8d wants to merge 1 commit into
6801318d8d wants to merge 1 commit into
Conversation
AnyLoginFailedEvent and TwoFactorProviderChallengeFailed now implement IWebhookCompatibleEvent, so admins can register webhooks that fire when a login fails (wrong password or unknown login name, or a failed second factor). The AnyLoginFailedEvent payload only contains the login name: the attempted password is never serialized. TwoFactorProviderChallengeFailed sends the user and the provider id and display name. Signed-off-by: 6801318d8d <144167388+6801318d8d@users.noreply.github.com> Assisted-by: ClaudeCode:claude-opus-5-5
6801318d8d
requested review from
a team,
ChristophWurst and
miaulalala
as code owners
October 26, 2026 14:34
6801318d8d
requested review from
Altahrim,
leftybournes,
salmart-dev and
sorbaugh
and removed request for
a team
October 26, 2026 14:34
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
webhook_listenersonly accepts events that implementIWebhookCompatibleEvent. The two events that describe failed logins did not, so registering a webhook for them was rejected with "… is not an event class compatible with webhooks", and an admin could not be notified (ntfy, Gotify, a chat webhook…) when someone fails to log in.This makes both events webhook compatible, the same way #60305 did for
UserFirstTimeLoggedInEvent:OCP\Authentication\Events\AnyLoginFailedEvent: the payload contains only the login name. The attempted password (getPassword()) is never serialized, and a unit test checks that.OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed: the payload contains the user (uid,displayName, viaJsonSerializer::serializeUser()) and the provider (id,displayName).Webhook body for a failed login (the top-level
userisnullbecause there is no session):{"event":{"loginName":"alice","class":"OCP\\Authentication\\Events\\AnyLoginFailedEvent"},"user":null,"time":1793024764}Notes:
WebhookCalljob. Nothing changes unless an admin registers a webhook for these events.How it was tested
tests/lib/Authentication/Events/AnyLoginFailedEventTest.phpandtests/lib/Authentication/TwoFactorAuth/TwoFactorProviderChallengeFailedTest.php.tests/lib/Authentication/TwoFactorAuth/ManagerTest.php,apps/admin_audit/tests/Listener/AuthEventListenerTest.php,apps/webhook_listeners/tests(PHP 8.5, SQLite).POST /ocs/v2.php/apps/webhook_listeners/api/v1/webhooksaccepted both events, then a failed WebDAV login (401) queued aWebhookCalljob with the body above.TODO
admin_manual/webhook_listeners/index.rstin nextcloud/documentation)Checklist
3. to review, feature component)stable32)AI (if applicable)