Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

operator/pkg/certs: mitigate potential null pointer dereference in AltNames Mutators for both the APIServer and EtcdServer #5560

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions operator/pkg/certs/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func etcdServerAltNamesMutator(cfg *AltNamesMutatorConfig) (*certutil.AltNames,
IPs: []net.IP{net.IPv4(127, 0, 0, 1)},
}

if cfg.Components.Etcd.Local != nil {
if cfg.Components != nil && cfg.Components.Etcd != nil && cfg.Components.Etcd.Local != nil {
appendSANsToAltNames(altNames, cfg.Components.Etcd.Local.ServerCertSANs)
}

Expand Down Expand Up @@ -488,7 +488,7 @@ func apiServerAltNamesMutator(cfg *AltNamesMutatorConfig) (*certutil.AltNames, e
fmt.Sprintf("*.%s.svc", cfg.Namespace)})
}

if len(cfg.Components.KarmadaAPIServer.CertSANs) > 0 {
if cfg.Components != nil && cfg.Components.KarmadaAPIServer != nil && len(cfg.Components.KarmadaAPIServer.CertSANs) > 0 {
appendSANsToAltNames(altNames, cfg.Components.KarmadaAPIServer.CertSANs)
}
if len(cfg.ControlplaneAddress) > 0 {
Expand Down