Skip to content

fix: guard against nil config document slices - #14357

Open
smira wants to merge 1 commit into
siderolabs:mainfrom
smira:fix/nulls-in-slices
Open

fix: guard against nil config document slices#14357
smira wants to merge 1 commit into
siderolabs:mainfrom
smira:fix/nulls-in-slices

Conversation

@smira

@smira smira commented Sep 11, 2026

Copy link
Copy Markdown
Member

This imports the gen library helper
siderolabs/gen#34, and uses that to decode any machine config document, guarding against various []*T places being nil.

Remove now unneded validation (which was incomplete anyways).

This protection applies to all code paths, including config patches.

This imports the gen library helper
siderolabs/gen#34, and uses that to decode any
machine config document, guarding against various `[]*T` places being
nil.

Remove now unneded validation (which was incomplete anyways).

This protection applies to all code paths, including config patches.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
Copilot AI lite review requested due to automatic review settings September 11, 2026 16:32
@github-project-automation github-project-automation Bot moved this to To Do in Planning Sep 11, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning Sep 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

In-memory configs can still contain nil entries and cause validation panics; equivalent guards must be retained.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR centralizes rejection of null elements in config collections during decoding, including patches, upgrades gen, and removes redundant validation.

Changes:

  • Upgrade github.com/siderolabs/gen.
  • Add null-element decoder checks and tests.
  • Remove overlapping validation checks.
File summaries
File Summary
pkg/machinery/go.sum Updates dependency checksums.
pkg/machinery/go.mod Upgrades the gen dependency.
pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go Removes nil-entry validation.
pkg/machinery/config/configloader/internal/decoder/decoder.go Rejects null collection elements during decoding.
pkg/machinery/config/configloader/internal/decoder/decoder_test.go Adds null-element decoder coverage.
go.sum Updates dependency checksums.
go.mod Updates the root gen dependency.
Review details
  • Files reviewed: 5/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go
@github-project-automation github-project-automation Bot moved this from In Review to Approved in Planning Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Proposed
Status: Approved

Development

Successfully merging this pull request may close these issues.

4 participants