internal/exec/stages/disks: guard against nil tang Thumbprint deref - #2290
internal/exec/stages/disks: guard against nil tang Thumbprint deref#2290vishnu2ko5 wants to merge 1 commit into
Conversation
This fixes a panic caused by an unchecked nil pointer dereference on tang.Thumbprint when processing LUKS clevis configurations.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 4 reviews per rolling hour; 2 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (3)**/*.go📄 CodeRabbit inference engine (AGENTS.md)
Files:
internal/exec/stages/{fetch-offline,fetch,disks,mount,files,umount}/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
internal/exec/stages/**⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughTang configuration generation now handles absent thumbprints without dereferencing a nil pointer. Present thumbprints remain unchanged. ChangesTang thumbprint handling
Estimated code review effort: 2 (Simple) | ~5 minutes Merge Risk: ⚪ Minimal · up to This localized change prevents a nil Thumbprint from causing a runtime panic during LUKS configuration processing; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What this PR does / why we need it:
This PR fixes a runtime panic caused by an unchecked nil pointer dereference on
tang.Thumbprintwhen processing LUKS clevis configurations.While the config validator enforces that
Thumbprintmust be present (ErrTangThumbprintRequired), this validation only runs for user-specified configs. Programmatically generated configs, configs merged dynamically, or system base configs can bypass this strict validation. IfThumbprintevaluates tonil, it previously caused a hard panic. This PR introduces a safe check, defaulting to an empty string to allow execution to proceed gracefully or fail appropriately downstream without crashing the provisioner.Fixes:
(Add the related issue number here if you opened an issue for this, e.g.,
Fixes #XYZ)Special notes for your reviewer:
tang.Thumbprintisnil, the value safely defaults to an empty string and the clevis configuration successfully marshals to JSON instead of triggering a panic.