Skip to content

Conversation

@rdslw
Copy link

@rdslw rdslw commented Oct 22, 2025

This fixes two nasty bugs with regard to pam handling. Users reported it in #114
Authored it with help of ampcode, but manually reviewed results and tested.

This also supersedes PR #181

@google-cla
Copy link

google-cla bot commented Oct 22, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Radosław Stachowiak and others added 2 commits November 15, 2025 18:08
When the user presses ESC or the prompt times out, the auth UI sends
PTYPE_RESPONSE_CANCELLED to the PAM conversation handler. Previously,
this returned PAM_CONV_ERR, which caused some PAM modules (particularly
with PAM 1.4.0+) to attempt authentication with empty input, resulting
in PAM_AUTH_ERR. This was counted by pam_faillock as a failed login
attempt, potentially locking users out after 3 ESC presses or timeouts.

The fix returns PAM_ABORT instead of PAM_CONV_ERR when receiving
PTYPE_RESPONSE_CANCELLED. This cleanly aborts the PAM authentication
session without counting as a failed attempt, which is the correct
semantic meaning of a user-initiated cancellation.

Fixes google#114

Amp-Thread-ID: https://ampcode.com/threads/T-60336806-26ca-40b3-bb77-86a913f74a0c
Co-authored-by: Amp <[email protected]>
Change the behavior of the ESC key to clear the password input field
(similar to Ctrl-U) instead of immediately canceling the authentication
prompt. This provides better UX - users who accidentally start typing
their password can press ESC to clear it and try again, rather than
having the prompt close.

Users can still cancel the prompt by waiting for the timeout, and the
previous commit ensures timeout/cancellation won't count as a failed
login attempt.

Related to google#114

Amp-Thread-ID: https://ampcode.com/threads/T-60336806-26ca-40b3-bb77-86a913f74a0c
Co-authored-by: Amp <[email protected]>
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.

1 participant