Repository navigation
fix(age-agent): redact sensitive protocol lines from debug logs - #3625
Merged
Merged
Conversation
The agent logged every received protocol line verbatim via
debug.Log("received: %s", line). The identities command carries
plaintext age private keys (bech32-encoded AGE-SECRET-KEY-1...) and
the decrypt command carries the full base64 ciphertext, so enabling
debug logging (GOPASS_DEBUG_LOG, inherited by the spawned agent)
persisted key material to the debug log file.
Instead of logging the raw line up front, each command arm in the
dispatch switch now logs its own redacted view, colocating the
sensitivity judgment with the command semantics:
- ping, status, lock, unlock, quit: log the verb
- set-timeout: the timeout value is not sensitive, log it verbatim
- identities: private keys are elided, only their count is logged
- decrypt: ciphertext is elided, only its encoded size is logged
(the relevant diagnostic for the scanner line-size limit, gopasspw#3508)
- unknown commands: the first token may itself be a mis-framed
payload (e.g. a bare AGE-SECRET-KEY-1... line from a
newline-separated identities send, see identitiesToString), so
only a 12-char prefix — at most the constant key-type prefix,
mirroring wrappedIdentity.SafeStr — and the line length are
logged
The raw line is never logged under any configuration. A regression
test covers the mis-framed identity line case.
Assisted-by: Claude-Code:GLM-5.3
Signed-off-by: Zexin Yuan <git@yzx9.xyz>
| } | ||
| case "identities": | ||
| // the arguments are private key material: log only their count | ||
| debug.Log("received: identities [%d ids]", len(args)) |
Member
There was a problem hiding this comment.
This is fine, but we could also include the actual identities using out.Secret. Those values are only printed if explicitly requested.
dominikschulz
approved these changes
Sep 29, 2026
yzx9
added a commit
to yzx9/gopass
that referenced
this pull request
Sep 30, 2026
Follow-up to gopasspw#3625 implementing the review suggestion: each received identity is now logged wrapped in out.Secret, so the debug log shows "(elided)" by default and the actual value only when GOPASS_DEBUG_LOG_SECRETS is set — matching the existing pattern in recipients.go. The decrypt command still logs only its encoded size. Assisted-by: Claude-Code:GLM-5.3
yzx9
added a commit
to yzx9/gopass
that referenced
this pull request
Sep 30, 2026
Follow-up to gopasspw#3625 implementing the review suggestion: each received identity is now logged wrapped in out.Secret, so the debug log shows "(elided)" by default and the actual value only when GOPASS_DEBUG_LOG_SECRETS is set — matching the existing pattern in recipients.go. The decrypt command still logs only its encoded size. Signed-off-by: Zexin Yuan <git@yzx9.xyz> Assisted-by: Claude-Code:GLM-5.3
dominikschulz
pushed a commit
that referenced
this pull request
Oct 1, 2026
Follow-up to #3625 implementing the review suggestion: each received identity is now logged wrapped in out.Secret, so the debug log shows "(elided)" by default and the actual value only when GOPASS_DEBUG_LOG_SECRETS is set — matching the existing pattern in recipients.go. The decrypt command still logs only its encoded size. Assisted-by: Claude-Code:GLM-5.3 Signed-off-by: Zexin Yuan <git@yzx9.xyz>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The agent logged every received protocol line verbatim via debug.Log("received: %s", line). The identities command carries plaintext age private keys (bech32-encoded AGE-SECRET-KEY-1...) and the decrypt command carries the full base64 ciphertext, so enabling debug logging (GOPASS_DEBUG_LOG, inherited by the spawned agent) persisted key material to the debug log file.
Instead of logging the raw line up front, each command arm in the dispatch switch now logs its own redacted view, colocating the sensitivity judgment with the command semantics:
bufio.Scanner64 KiB line limit silently drops largedecryptcommands #3508)The raw line is never logged under any configuration. A regression test covers the mis-framed identity line case.
Assisted-by: Claude-Code:GLM-5.3