Rootless Auth.json vs Credential Helper: Which Minimizes Credential Exposure for Expired Tokens?
0 reputation · 05 Dec 2021, 20:24 UTC
0 reputation · 05 Dec 2021, 20:24 UTC
Determine the least‑privilege approach for handling authentication in rootless Podman when credentials become stale.
Rootless mode relies on user namespaces and stores credentials in ~/.config/containers/auth.json. Credential helpers can offload tokens to system keyrings, but their integration with rootless authentication is unclear. Expired tokens must be refreshed automatically to avoid pull failures.
The current behavior of automatic credential refresh differs between using a plaintext auth.json and a third‑party credential helper. It is not documented whether a helper can detect expiration and trigger a login without user intervention, or if the helper’s keyring integration fully protects the token from accidental exposure.
35775 reputation · 06 Dec 2021, 03:27 UTC
For rootless Podman with standard credential helpers, expired tokens are not refreshed automatically. Manual podman login is required after expiration, just as it is with a plaintext ~/.config/containers/auth.json. A credential helper reduces on-disk exposure by keeping the token in the user keyring instead of auth.json, but it does not guarantee that no plaintext copy exists anywhere on the host, and it does not change Podman's expiration behavior.
Confirmed in recent Podman releases (4.x and 5.x line, subject to version verification):
auth.json stores base64-encoded credentials on disk. Podman reads them as-is; when the registry returns 401, Podman surfaces an authentication error and does not silently retry with new credentials.credential-helper is configured in containers-auth.json or via podman login --credential-helper, Podman delegates storage and retrieval to the helper. The standard helpers (docker-credential-secret-service, docker-credential-pass, docker-credential-osxkeychain) store the secret in the system keyring and do not write a token entry into auth.json.Implementation-dependent (verify before relying on it):
get call. That refresh logic lives in the helper, not in Podman.| Storage location | Plain auth.json | Standard credential helper |
|---|---|---|
| Token at rest | Base64 text in ~/.config/containers/auth.json | Keyring entry (Secret Service, pass, macOS Keychain) |
| Automatic refresh on expiry | No | No (standard helpers) |
| Manual re-login required | Yes | Yes |
| Additional plaintext risk | File readable by user/root | Possible helper temp files; keyring must be unlocked |
podman login --username <user> registry.example.orgThen confirm the registry key is absent from the auths map without printing the secret:jq '.auths | keys' ~/.config/containers/auth.jsonPODMAN_DEBUG=1 podman pull registry.example.org/image:tagObserve whether the helper is queried again after a 401 or whether Podman exits with an auth error immediately.If your goal is least privilege and reduced exposure, use a standard credential helper so tokens live in the keyring rather than auth.json. Accept that expired tokens still require podman login. If you need unattended refresh, you must supply a helper that implements token renewal; Podman will not do it for you.
Missing diagnostic: Which credential helper and version are you using? If it is a standard helper, the answer above holds. If it is a custom or OIDC-aware helper, the refresh behavior may differ and the recommendation changes.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.