Skip to content

[Wizard] Hostname is never validated — empty or invalid hostnames pass through to Ignition config #21

Description

@castrojo

Summary

The wizard's validateUser() method validates usernames and SSH keys but does not validate the hostname, even though the hostname is entered on the same User step. The validate.Hostname() function exists but is never called anywhere in the wizard validation flow.

Steps to Reproduce

  1. Advance through the wizard to the User step
  2. Leave the Hostname field empty (or enter an invalid value like "---" or a 100-char string)
  3. Fill in a valid username and SSH key
  4. Press Enter — validation passes
  5. Continue to Review and Install
  6. The generated Butane YAML contains inline: "" or an invalid hostname

Expected

wizard.validateUser() (or a dedicated validateHostname() call) should call validate.Hostname(cfg.Hostname) and reject empty/invalid hostnames before advancing past the User step.

Actual

validateUser() only checks Users and SSHKeys:

func (w *Wizard) validateUser() error {
    if len(w.State.Config.Users) == 0 && len(w.State.Config.SSHKeys) == 0 {
        return fmt.Errorf("at least one user or SSH key is required")
    }
    // ... validates usernames and SSH keys, but NOT hostname
}

The hostname flows directly into the Butane template unvalidated:

contents:
    inline: "{{.Hostname}}"

An empty hostname produces inline: "" which results in a machine with no hostname set, making fleet management and DNS difficult.

Severity

High — Silent misconfiguration. An empty hostname is a common oversight and should be caught before writing to disk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    1-triageNew work awaiting human triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions