Skip to content

fix(auth): capture PAM messages and set TTY item#100

Merged
arran4 merged 5 commits intomasterfrom
fix-pam-auth-details-14443616570265861596
Apr 17, 2026
Merged

fix(auth): capture PAM messages and set TTY item#100
arran4 merged 5 commits intomasterfrom
fix-pam-auth-details-14443616570265861596

Conversation

@arran4
Copy link
Copy Markdown
Owner

@arran4 arran4 commented Apr 17, 2026

Fixes an issue where PAM auth failures were returning generic error messages without logging actual PAM module rejections, and improves transaction handling.


PR created automatically by Jules for task 14443616570265861596 started by @arran4

This commit addresses missing context and leaked state in PAM auth.
1. Captures `pam.ErrorMsg` and `pam.TextInfo` messages during conversation to provide context when `tx.Authenticate` or `tx.AcctMgmt` fail.
2. Extracts the terminal via `/proc/self/fd/0` and supplies it to PAM via `tx.SetItem(pam.Tty, ...)`.
3. Adds `defer tx.End()` to correctly finalize the transaction.

Co-authored-by: arran4 <111667+arran4@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

This commit fixes a linting error reported by errcheck in `golangci-lint` by explicitly ignoring the returned error from `tx.End()`.

Co-authored-by: arran4 <111667+arran4@users.noreply.github.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the PAM authenticator by capturing informational and error messages from the PAM transaction to provide more detailed error feedback. It also introduces TTY detection and ensures proper cleanup of the PAM transaction. Feedback suggests improving the TTY detection logic to be less brittle, refining the message collection to avoid empty strings, and clearing the message buffer between different PAM phases to prevent cross-contamination of error messages.

Comment thread auth/pam.go Outdated
Comment thread auth/pam.go Outdated
Comment thread auth/pam.go
google-labs-jules Bot and others added 3 commits April 17, 2026 00:50
This commit clears the collected `pamMsgs` after a successful `Authenticate` phase so that unrelated or informational messages do not incorrectly leak into the error generated if `tx.AcctMgmt` subsequently fails.

Co-authored-by: arran4 <111667+arran4@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@arran4 arran4 merged commit b521c04 into master Apr 17, 2026
6 checks passed
@arran4 arran4 deleted the fix-pam-auth-details-14443616570265861596 branch April 17, 2026 01:19
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