Skip to content

passdriver: fix errors "no such secret" errors#948

Open
inknos wants to merge 1 commit into
podman-container-tools:mainfrom
inknos:podman-issue-28938
Open

passdriver: fix errors "no such secret" errors#948
inknos wants to merge 1 commit into
podman-container-tools:mainfrom
inknos:podman-issue-28938

Conversation

@inknos

@inknos inknos commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

When gpg --decrypt fails for any reason other than the file being absent, Lookup() was returning ErrNoSuchSecret.
GPG's stderr was also discarded, making the real cause invisible.

Four issues found:

  • Lookup: use os.Stat to separate "file absent" (ErrNoSuchSecret) from "decrypt failed"
  • Lookup: capture GPG stderr so decrypt failures produce a diagnostic message instead of "no such secret"
  • Store: check file existence via os.Stat instead of Lookup, so a secret that exists but is temporarily unreadable is not silently overwritten
  • List: skip directories and non-.gpg files. The previous slice would panic on or return as garbage IDs

Fixes: podman-container-tools/podman#28938

@github-actions github-actions Bot added the common Related to "common" package label Jun 29, 2026

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a quick drive-by, I have never read this code.

Comment thread common/pkg/secrets/passdriver/passdriver.go Outdated
Comment thread common/pkg/secrets/passdriver/passdriver.go Outdated
Comment thread common/pkg/secrets/passdriver/passdriver.go Outdated
Comment thread common/pkg/secrets/passdriver/passdriver.go Outdated
When gpg --decrypt fails for any reason other than the file being
absent, Lookup() was returning ErrNoSuchSecret.
GPG's stderr was also discarded, making the real cause invisible.

Four issues found:

- Lookup: use fileutils.Exists to separate "file absent"
  (ErrNoSuchSecret) from "decrypt failed"
- gpg: always capture stderr and fold it into the returned
  error so all callers get diagnostic output on failure
- Store: check file existence via fileutils.Exists instead
  of Lookup, so a secret that exists but is temporarily
  unreadable is not silently overwritten
- List: skip directories and non-.gpg files. The previous
  slice would panic on or return as garbage IDs

Fixes: podman-container-tools/podman#28938

Signed-off-by: Nicola Sella <nsella@redhat.com>
@inknos inknos force-pushed the podman-issue-28938 branch from df118b6 to 2d5a297 Compare June 30, 2026 09:37

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! Looks good briefly looking at the diff; I think a proper careful review by someone else would be nice but perhaps not blocking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Podman cannot fetch secrets created with the pass driver

2 participants