Language: Go
Label: safe
CWE: CWE-863 \u2014 Incorrect Authorization
The product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. This allows attackers to bypass intended access restrictions.

Code:
func Register(mgr manager.Manager, cfg config.Config) error {
	client, err := kubelet.InitNodeAuthorizedClient(cfg.KubeletConfigPath)
	if err != nil {
		return err
	}

	csiDriver := NewDriver(cfg.NodeId, cfg.Endpoint, mgr.GetClient(), mgr.GetAPIReader(), client)

	if err := mgr.Add(csiDriver); err != nil {
		return err
	}

	return nil
}