Skip to content

fix(age): prevent agent panic when decrypting plugin identities - #3633

Merged
dominikschulz merged 1 commit into
gopasspw:masterfrom
ermengchao:fix/age-agent-plugin-ui-3620
Oct 1, 2026
Merged

dominikschulz merged 1 commit into
gopasspw:masterfrom
ermengchao:fix/age-agent-plugin-ui-3620

Conversation

@ermengchao

Copy link
Copy Markdown
Contributor

Summary

Fixes #3620, including my [macOS Secure Enclave reproduction](#3620 (comment)).

The age agent constructs plugin identities with a nil ClientUI. In age v1.3.2, ClientUI.readStanza dereferences this pointer, causing a panic during plugin decryption.

This change supplies an empty, non-nil plugin.ClientUI. Plugins can decrypt normally without client UI callbacks. Unavailable UI requests receive the protocol's fail response, allowing plugins to return an ordinary error instead of crashing the agent.

Regression coverage

Add a hardware-independent test plugin that exercises the actual identity-v1 subprocess protocol through Agent.decrypt, covering:

  • Successful decryption and the gopass recipient suffix.
  • Message, public input, secret input, and confirmation requests.
  • Successful decryption on the same agent after each interaction failure.

Removing the fix reproduces the original nil-pointer panic. No panic recovery or dependency changes are introduced.

Validation

  • Regression tests and relevant age backend tests pass, including with the race detector.
  • Formatting, agent go vet, license-lint, golangci-lint, and keep-sorted pass.
  • govulncheck ./... reports no called vulnerabilities.
  • make test and make test-integration were run, but Unix socket restrictions in the cloud environment prevent agent sockets and gpg-agent from starting. The affected age unit tests also fail on unmodified master.
  • make codequality was run but is blocked by capslock: its source-processing dependency is incompatible with Go 1.27; under Go 1.26.1, its capability comparison produces the same failure as unmodified master.

I also tested the patched build locally on macOS with age-plugin-se 0.2.1, retaining only the SE identity. Touch ID authorization and secret decryption succeeded, the command exited with status 0, and the agent remained running. Debug logs showed no agent error or fallback to direct decryption.

Scope

This fixes the plugin identity panic. It does not add background terminal UI forwarding, cache Touch ID authorization or decrypted file keys, or recover stale sockets. Touch ID may still be required for each decryption.

Hardware validation with age-plugin-tpm remains outstanding.

Signed-off-by: エモン <zhangchao050530@gmail.com>
@dominikschulz
dominikschulz merged commit 239ce74 into gopasspw:master Oct 1, 2026
10 checks passed
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.

age agent panics when decrypting with an age-plugin-tpm identity (nil ClientUI)

2 participants

⌂ 换网址