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:
			change, err := controllerutil.CreateOrUpdate(ctx, r.Client, ns, func() error {
				if ns.Labels == nil {
					ns.Labels = map[string]string{}
				}
				ns.Labels = helper.SetPodSecurity(ns.Labels)
				return nil
			})
			if err != nil {
				return err
			}
			r.Logger.V(1).Info("create or update ns", "change", change, "ns", ns.Name)
			return nil
		})