kubernetes-sigs/cluster-api

Fields that are taking URLs or OCI registry paths should validate for correctness

Open

#7,257 opened on Sep 21, 2022

View on GitHub
 (16 comments) (2 reactions) (0 assignees)Go (1,532 forks)auto 404
help wantedkind/buglifecycle/frozenpriority/backlogtriage/accepted

Repository metrics

Stars
 (4,267 stars)
PR merge metrics
 (PR metrics pending)

Description

What steps did you take and what happened: [A clear and concise description on how to REPRODUCE the bug.]

Use a kubeadmControlPlane with the following

spec:
  kubeadmConfigSpec:
    clusterConfiguration:
        dns:
          imageRepository: |
            registry.contoso.com/kubernetes
                 s
       ...

The image repository then has a new line character in it. This is currently treated as valid, but should be rejected, and the end result is that the user may not know they've something wrong until the KCP machine fails to boot.

What did you expect to happen:

Anywhere we are reading an OCI registry or a http URL, we should verify that these are valid for URI paths. There's parsing functions in the Go std library under URL as well as functions in docker/distribution/reference.

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

Environment:

  • Cluster-api version: v1.2.2
  • minikube/kind version: N/A
  • Kubernetes version: (use kubectl version): N/A
  • OS (e.g. from /etc/os-release): N/A

/kind bug [One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels]

Contributor guide