Skip to content

pam/gdm: Ignore GDM echo of our own auth mode selection - #1623

Draft
adombeck wants to merge 4 commits into
mainfrom
1121-fix-double-mode-selection
Draft

pam/gdm: Ignore GDM echo of our own auth mode selection#1623
adombeck wants to merge 4 commits into
mainfrom
1121-fix-double-mode-selection

Conversation

@adombeck

@adombeck adombeck commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Important

This is based on #1745

Device authentication through GDM could hang on the QR screen even after the user completed the browser flow. The QR screen showed one device code while the broker kept polling for a different one, so the authorization the user granted was never observed and the login stalled until the device code expired.

When an auth mode is auto-selected, the adapter both calls SelectAuthenticationMode (minting a device code and starting the poll) and tells GDM to select that mode. GDM echoes the selection back in its next poll, and the adapter treated that echo as a fresh selection, issuing a second SelectAuthenticationMode that minted a new device code and orphaned the first poll.

Track the selection we send to GDM and drop its echo. The suppression is a one-shot consumed by the first matching echo, and is also cleared on any stage change, so a genuine re-selection of the same mode (the user navigating back to auth mode selection and picking it again) is still honored. A pure stage-change reset raced with the echo in the change-password flow; a pure one-shot swallowed legitimate re-selection of an auto-selected single mode. Combining both covers each gap.

e2e-ppa: authd-dev

Closes #1121
UDENG-10830

Important

This fixes #1121 but causes #1424 to occur on almost each login attempt, so we have to release this together with the fix for #1424.

@adombeck adombeck added the e2e-tests This issue is related to end-to-end tests / Run end-to-end tests on this pull request label Jun 25, 2026
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.00%. Comparing base (31f8478) to head (79225fb).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1623      +/-   ##
==========================================
+ Coverage   84.24%   88.00%   +3.76%     
==========================================
  Files          21       99      +78     
  Lines        1168     6839    +5671     
  Branches        0      111     +111     
==========================================
+ Hits          984     6019    +5035     
- Misses        184      764     +580     
- Partials        0       56      +56     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread pam/internal/adapter/gdmmodel.go Outdated
}

func (m gdmModel) handlePollResponse(gdmPollResults []*gdm.EventData) tea.Cmd {
func (m *gdmModel) handlePollResponse(gdmPollResults []*gdm.EventData) tea.Cmd {

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.

Ideally these should never be pointers, but rather return the updated model, if that does not happen we need to figure out something else...

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.

done

@adombeck
adombeck force-pushed the 1121-fix-double-mode-selection branch 2 times, most recently from 19e671f to 0ef1673 Compare July 18, 2026 13:44
AccountsService can enumerate NSS users before authd has completed its
socket-activated startup, leaving the GDM user cache without managed
accounts until they log in once. Start authd as part of the NSS lookup
target and make that target wait for the daemon to become ready.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adombeck adombeck added e2e-tests This issue is related to end-to-end tests / Run end-to-end tests on this pull request and removed e2e-tests This issue is related to end-to-end tests / Run end-to-end tests on this pull request labels Jul 18, 2026
adombeck and others added 2 commits July 19, 2026 14:48
Allow e2e test PRs to opt into the authd-dev PPA through their
description. The selected PPA replaces authd-edge while APT resolves the
dependencies of the authd package built from the PR. This allows us to
depend on the gnome-shell version from the authd-dev PPA.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Device authentication through GDM could hang on the QR screen even after
the user completed the browser flow. The QR screen showed one device
code while the broker kept polling for a different one, so the
authorization the user granted was never observed and the login stalled
until the device code expired.

When an auth mode is auto-selected, the adapter both calls
SelectAuthenticationMode (minting a device code and starting the poll)
and tells GDM to select that mode. GDM echoes the selection back in its
next poll, and the adapter treated that echo as a fresh selection,
issuing a second SelectAuthenticationMode that minted a new device code
and orphaned the first poll.

Track the selection we send to GDM and drop its echo. The suppression is
a one-shot consumed by the first matching echo, and is also cleared on
any stage change, so a genuine re-selection of the same mode (the user
navigating back to auth mode selection and picking it again) is still
honored. A pure stage-change reset raced with the echo in the
change-password flow; a pure one-shot swallowed legitimate re-selection
of an auto-selected single mode. Combining both covers each gap.

Use a value-returning poll handler so Bubble Tea owns model state
transitions. Preserve the origin of selections so GDM-originated
selections do not arm suppression intended only for the
adapter-generated echo.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adombeck
adombeck force-pushed the 1121-fix-double-mode-selection branch 2 times, most recently from a8b139e to ad02d0c Compare July 19, 2026 12:50
A single gnome-shell version cannot represent both Noble and Resolute,
because each series has a different upstream base and PPA versioning
scheme. Generate the Breaks relationship from the changelog target suite
and reject unknown suites to prevent silently omitting the constraint.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adombeck

Copy link
Copy Markdown
Contributor Author

This fixes #1121 but causes #1424 to occur on almost each login attempt, so we have to release this together with the fix for #1424.

The authd Debian package built from this branch now requires a gnome-shell version that contains my fix. That is currently only available in the authd-dev PPA. Before merging this, we should copy these gnome-shell packages to the authd-edge PPA, and before releasing the next authd stable release, we should copy them to the authd PPA.

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

Labels

e2e-tests This issue is related to end-to-end tests / Run end-to-end tests on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Device code sometimes changes automatically in GDM

2 participants