Skip to content

fix: search all Podman auth file locations per containers-auth.json(5) spec#46

Merged
pavelanni merged 2 commits into
mainfrom
bug/linux-auth-paths
May 28, 2026
Merged

fix: search all Podman auth file locations per containers-auth.json(5) spec#46
pavelanni merged 2 commits into
mainfrom
bug/linux-auth-paths

Conversation

@pavelanni

@pavelanni pavelanni commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Renamed podmanAuthPath()podmanAuthPaths() to return all candidate
    auth file locations per the containers-auth.json(5) spec
  • Search order: $XDG_RUNTIME_DIR/containers/auth.json first (Linux primary),
    then $XDG_CONFIG_HOME/containers/auth.json (fallback, defaults to ~/.config)
  • credentialStore() now chains all found Podman stores as fallbacks
  • Deduplicates paths when XDG_CONFIG_HOME resolves to the same location
  • Added unit tests for all path resolution scenarios

Fixes #45

Test plan

  • TestPodmanAuthPaths covers: XDG_RUNTIME_DIR priority, XDG_CONFIG_HOME fallback, deduplication, no-XDG fallback
  • Full pkg/oci test suite passes
  • golangci-lint clean

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests

    • Added tests verifying Podman authentication path discovery with proper fallback behavior.
  • Improvements

    • Enhanced credential loading to check multiple standard container authentication file locations instead of a single path, improving compatibility across different system configurations.

…) spec

On Linux, Podman writes credentials to $XDG_RUNTIME_DIR/containers/auth.json,
but skillctl only checked one path. Now podmanAuthPaths() returns all candidate
locations in spec order and credentialStore() chains them as fallbacks.

Fixes #45

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Pavel Anni <panni@redhat.com>
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 71c9d63b-db83-4e10-9348-a606697c1952

📥 Commits

Reviewing files that changed from the base of the PR and between 92dde21 and ac734f1.

📒 Files selected for processing (2)
  • pkg/oci/credentials_test.go
  • pkg/oci/push.go

📝 Walkthrough

Walkthrough

The PR extends credential loading to search multiple Podman authentication file locations per XDG specification. A new podmanAuthPaths() helper returns an ordered, deduplicated list of candidate paths from XDG_RUNTIME_DIR, XDG_CONFIG_HOME, and ~/.config fallback. credentialStore() now iterates these paths, checks file readability, and combines any found Podman stores with Docker credentials.

Changes

Podman authentication file location support

Layer / File(s) Summary
Multi-location auth path resolution
pkg/oci/push.go
Imports log/slog for debug logging. Implements podmanAuthPaths() helper that returns an ordered slice of candidate containers/auth.json locations derived from XDG_RUNTIME_DIR and XDG_CONFIG_HOME environment variables with ~/.config fallback, ensuring no duplicate entries. Refactors credentialStore() to iterate candidate paths from podmanAuthPaths(), skip missing/unreadable files with debug logs, and build a list of Podman stores to combine with Docker credentials.
Test coverage for path ordering and fallback
pkg/oci/credentials_test.go
TestPodmanAuthPaths verifies XDG_RUNTIME_DIR takes precedence in returned paths, XDG_CONFIG_HOME appears as fallback, duplicate directories are deduplicated to a single entry, and unset XDG variables fall back to ~/.config/containers/auth.json via os.UserHomeDir().

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: searching all Podman auth file locations per the containers-auth.json(5) spec instead of a single path.
Linked Issues check ✅ Passed The PR fully implements the requirements from issue #45: searching XDG_RUNTIME_DIR first, then XDG_CONFIG_HOME, with Docker fallback, and includes comprehensive test coverage.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the spec-compliant Podman auth file location search per issue #45; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug/linux-auth-paths

Comment @coderabbitai help to get the list of available commands and usage tips.

Replace tautological dedupe test with one that exercises the actual
dedup branch (both XDG vars pointing to same directory). Add slog.Debug
for skipped auth files to help users troubleshoot credential issues.

Addresses review feedback from PR #46.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Pavel Anni <panni@redhat.com>
@pavelanni pavelanni marked this pull request as ready for review May 28, 2026 16:06
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Actionable comments posted: 0

@pavelanni pavelanni merged commit f2a8bb6 into main May 28, 2026
6 checks passed
@pavelanni pavelanni deleted the bug/linux-auth-paths branch May 28, 2026 16:17
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.

Additional auth file locations

1 participant