You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: prevent panic on nil APIResource in permission validator
Add a nil check for the APIResource parameter in the permission
validator callback to prevent panic when API server connectivity
is interrupted during sync operations. Extracted the function
for testability. Added Unit Tests.
Fixes#26608
Signed-off-by: Andy Lo-A-Foe <andy.loafoe@gmail.com>
// if there is no match found in the AppProject.Spec.DestinationServiceAccounts, use the default service account of the destination namespace.
605
592
return"", fmt.Errorf("no matching service account found for destination server %s and namespace %s", application.Spec.Destination.Server, serviceAccountNamespace)
606
593
}
594
+
595
+
// validateSyncPermissions checks whether the given resource is permitted by the project's
596
+
// allow/deny lists and destination rules. It returns an error if the API resource info is nil
597
+
// (preventing a nil-pointer panic), if the resource's group/kind is not permitted, or if
598
+
// the resource's namespace is not an allowed destination.
0 commit comments