feat(snap): expose password-manager-service plug and guide users to connect it
What does this MR do and why?
The glab snap ships under strict confinement, and the manifest at snap/snapcraft.yaml doesn't declare any interface that lets the process talk to the D-Bus Secret Service. As a result, glab auth login on the snap always falls through to the plaintext fallback and prints:
WARNING: The operating system keyring is unavailable. Storing credentials as plaintext in the configuration file.
The warning offers no path forward, so users file bugs (#8496 (closed)).
This MR:
- Adds the
password-manager-serviceplug to the snap manifest. snapd does not auto-connect this interface, so users still need to opt in withsudo snap connect glab:password-manager-service— but the plug has to exist for that command to work at all. The reporter of #8496 (closed) hit exactly this:sudo snap connect glab:password-manager-servicefailed withsnap "glab" has no plug named "password-manager-service". - Extends the existing plaintext-fallback warning in
internal/commands/auth/login/login.goand the plaintext-migration nudge ininternal/commands/auth/status/status.goto name the exact snap-connect command when running under snap confinement. - Adds a small
SnapConfined()helper ininternal/commands/auth/authutils/snap.go. Detection uses theSNAPenvironment variable that snapd sets on every confined process, matching the pattern already used byglab duo cliininternal/commands/duo/cli/cli.go. - Adds a Credential storage section to
docs/source/authentication.mdcovering keyring behavior across platforms, the plaintext fallback, and the snap-specific requirement. Updates the Snapcraft step indocs/installation_options.mdwith the newsnap connectcommand, parallel to the existingssh-keysstep.
Users not running under snap see zero change.
Why not request auto-connect?
Auto-connect for password-manager-service is rarely granted — reviewers have declined similar requests even for well-known password-adjacent CLIs (Bitwarden, Actioneer). We can still open a Store request separately, but the manual-connect path is what users will realistically experience, so the tool and docs should teach them the exact command.
User experience
Fresh snap install:
$ sudo snap install glab
$ glab auth login
WARNING: The operating system keyring is unavailable. Storing credentials as plaintext in the configuration file.
glab is running under snap confinement. To enable OS keyring storage, run:
sudo snap connect glab:password-manager-service
Then re-run glab auth login to migrate this token into the keyring.Existing plaintext token, running glab auth status:
gitlab.com
✓ Token found in configuration file (plaintext): ****
! To store this token more securely, run glab auth login --hostname gitlab.com to move it into the operating system keyring.
Under snap confinement, first run sudo snap connect glab:password-manager-service to grant keyring access.Test plan
-
make checkpasses locally (4345 tests, 0 lint issues). - New unit tests:
Test_keyringUnavailableUnderSnapShowsConnectHint(login),Test_statusRun_keyringMigrationHint_snapConfined(status),TestSnapConfined(helper). - Existing plaintext-fallback tests explicitly clear
SNAPand assert the snap hint is absent — protects against accidental output drift. - Docs pass
markdownlint,vale, andlychee(verified bylefthook run pre-push). - Verified pre-merge on Ubuntu 24.04 (GCE VM) with this MR's own
snapcraft_build_edgeartifact: the plug is present,sudo snap connect glab:password-manager-servicesucceeds, andglab auth loginthen stores the token in the OS keyring, migrating it out of the plaintext config file. Full results in this comment.
Closes #8496 (closed).