fix: treat permission denied as graceful config fallback (distroless nonroot)#53
Conversation
In distroless containers running as nonroot (UID 65534), attempting to read config/matcher.yaml under a root-owned directory returns EACCES instead of ENOENT. The app should fall back to env-only configuration in both cases. Updated isConfigFileNotFound to also handle os.IsPermission and wrapped permission errors via errors.Is(err, os.ErrPermission). Closes LerianStudio#52
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe changes extend the 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment |
Problem
Matcher crashes on startup in distroless containers:
Root Cause
isConfigFileNotFound()only checked forENOENT, notEACCES. In distroless:nonroot containers, the root-owned directory returns permission denied instead of file-not-found.Fix
Added
os.IsPermission(err) || errors.Is(err, os.ErrPermission)toisConfigFileNotFound()so both error types trigger graceful fallback to env-only configuration.Tests added for direct and wrapped permission errors.
Closes #52