Skip to content

[Bug]: No cloud-init Extra map key collision validation #7

Description

@mrhillsman

Bug Description

`internal/cloudinit/cloudinit.go` (lines 69-72) merges arbitrary keys from `opts.Extra` into the cloud-config document without checking for collisions with standard keys (`packages`, `runcmd`, `write_files`, `users`, `ssh_pwauth`). A workload that includes any of these standard keys in its Extra map will silently overwrite the builder's values, producing a broken cloud-init config.

Steps to Reproduce

  1. Create a workload that sets `opts.Extra["packages"] = [...]]` with custom packages
  2. The cloud-init builder also sets `packages` from its own logic
  3. The Extra merge overwrites the builder's package list
  4. The resulting cloud-init config is missing required packages

Expected Behavior

Either validate that Extra keys don't collide with reserved keys (returning an error), or merge list/map-type values instead of overwriting.

Actual Behavior

Extra keys silently overwrite standard cloud-config keys, producing broken configurations.

Command

virtwork run

Go Version

Not provided

Deployment Mode

Not provided

Additional Context

Severity: Medium

Files:

  • `internal/cloudinit/cloudinit.go:69-72` — unchecked `Extra` merge

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.size/SDenotes a PR that changes 10-29 lines, ignoring generated files.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions