fix principal and role variables are not substituted
package utils
import (
+ "encoding/json"
+ "strings"
+
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
"github.com/kyverno/kyverno/pkg/autogen"
@@ -51,6 +54,14 @@ func checkForRBACInfo(rule kyvernov1.Rule) bool {
}
}
}
+
+ if bytes, err := json.Marshal(rule); err != nil {
+ return false
+ } else {
+ if strings.Contains(string(bytes), "request.roles") || strings.Contains(string(bytes), "request.clusterRoles") {
+ return true
+ }
+ }
return false
}
