Skip to content

Fix rejected headless authentication path#62634

Closed
danielashare wants to merge 1 commit intomasterfrom
danielashare/fix-headless-rejects
Closed

Fix rejected headless authentication path#62634
danielashare wants to merge 1 commit intomasterfrom
danielashare/fix-headless-rejects

Conversation

@danielashare
Copy link
Copy Markdown
Contributor

@danielashare danielashare commented Jan 6, 2026

Since v17, if a user rejects a headless authentication request, the call to update the headless authentication state on the backend would fail due to calling a function on a nil pointer. This would leave the headless authentication object in a pending state (cleaned up after 3 minutes) and no audit log showing rejection.

Manual tests:

  • Test approvals still work with TouchID and Passkeys
  • Test denies are fixed with TouchID and Passkeys

changelog: Fixed a server panic when denying a headless authentication attempt

Comment thread lib/web/headless.go Outdated
@danielashare danielashare force-pushed the danielashare/fix-headless-rejects branch from 43d9a80 to 2bef5d5 Compare January 8, 2026 11:30
Comment thread lib/web/headless.go
var mfaResp *proto.MFAAuthenticateResponse
switch req.Action {
case "accept":
if req.MFAResponse != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So here, we implicitly assume that MFAResponse will always be non-nil if Action is "accept". What if it's nil, then? Previously it would lead to a panic in all cases (though as you wrote, it was only when the request was denied). Now, even in case of "accept", we would move on and mark the state to approved with a nil mfaResp. Perhaps we should return an error if the response is nil?

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 Action is accept and the mfaResp is nil, an audit event is emitted and an error is returned by the UpdateHeadlessAuthenticationState call that happens just after this switch statement. I thought it was best to leave it to the update function to handle the error and emit audit events. What do you think?

@danielashare
Copy link
Copy Markdown
Contributor Author

Forgot to merge this one, and it was solved by #63189, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants