@@ -231,6 +231,13 @@ func (handler *HelmAppRestHandlerImpl) handleFluxApplicationHibernate(r *http.Re
231231		return  nil , err 
232232	}
233233
234+ 	// Validate confirmation name if provided 
235+ 	if  hibernateRequest .ConfirmationName  !=  nil  {
236+ 		if  * hibernateRequest .ConfirmationName  !=  appIdentifier .AppName  {
237+ 			return  nil , errors .New ("confirmation name does not match application name" )
238+ 		}
239+ 	}
240+ 
234241	if  ! handler .enforcer .Enforce (token , casbin .ResourceGlobal , casbin .ActionUpdate , "*" ) {
235242		return  nil , errors .New ("unauthorized" )
236243	}
@@ -243,6 +250,13 @@ func (handler *HelmAppRestHandlerImpl) handleArgoApplicationHibernate(r *http.Re
243250		return  nil , err 
244251	}
245252
253+ 	// Validate confirmation name if provided 
254+ 	if  hibernateRequest .ConfirmationName  !=  nil  {
255+ 		if  * hibernateRequest .ConfirmationName  !=  appIdentifier .AppName  {
256+ 			return  nil , errors .New ("confirmation name does not match application name" )
257+ 		}
258+ 	}
259+ 
246260	if  ! handler .enforcer .Enforce (token , casbin .ResourceGlobal , casbin .ActionUpdate , "*" ) {
247261		return  nil , errors .New ("unauthorized" )
248262	}
@@ -255,6 +269,14 @@ func (handler *HelmAppRestHandlerImpl) handleHelmApplicationHibernate(r *http.Re
255269	if  err  !=  nil  {
256270		return  nil , err 
257271	}
272+ 
273+ 	// Validate confirmation name if provided 
274+ 	if  hibernateRequest .ConfirmationName  !=  nil  {
275+ 		if  * hibernateRequest .ConfirmationName  !=  appIdentifier .ReleaseName  {
276+ 			return  nil , errors .New ("confirmation name does not match application name" )
277+ 		}
278+ 	}
279+ 
258280	rbacObject , rbacObject2  :=  handler .enforcerUtil .GetHelmObjectByClusterIdNamespaceAndAppName (
259281		appIdentifier .ClusterId ,
260282		appIdentifier .Namespace ,
@@ -317,6 +339,14 @@ func (handler *HelmAppRestHandlerImpl) handleFluxApplicationUnHibernate(r *http.
317339	if  err  !=  nil  {
318340		return  nil , err 
319341	}
342+ 
343+ 	// Validate confirmation name if provided 
344+ 	if  hibernateRequest .ConfirmationName  !=  nil  {
345+ 		if  * hibernateRequest .ConfirmationName  !=  appIdentifier .AppName  {
346+ 			return  nil , errors .New ("confirmation name does not match application name" )
347+ 		}
348+ 	}
349+ 
320350	if  ! handler .enforcer .Enforce (token , casbin .ResourceGlobal , casbin .ActionUpdate , "*" ) {
321351		return  nil , errors .New ("unauthorized" )
322352	}
@@ -327,6 +357,14 @@ func (handler *HelmAppRestHandlerImpl) handleArgoApplicationUnHibernate(r *http.
327357	if  err  !=  nil  {
328358		return  nil , err 
329359	}
360+ 
361+ 	// Validate confirmation name if provided 
362+ 	if  hibernateRequest .ConfirmationName  !=  nil  {
363+ 		if  * hibernateRequest .ConfirmationName  !=  appIdentifier .AppName  {
364+ 			return  nil , errors .New ("confirmation name does not match application name" )
365+ 		}
366+ 	}
367+ 
330368	if  ! handler .enforcer .Enforce (token , casbin .ResourceGlobal , casbin .ActionUpdate , "*" ) {
331369		return  nil , errors .New ("unauthorized" )
332370	}
@@ -339,6 +377,13 @@ func (handler *HelmAppRestHandlerImpl) handleHelmApplicationUnHibernate(r *http.
339377		return  nil , err 
340378	}
341379
380+ 	// Validate confirmation name if provided 
381+ 	if  hibernateRequest .ConfirmationName  !=  nil  {
382+ 		if  * hibernateRequest .ConfirmationName  !=  appIdentifier .ReleaseName  {
383+ 			return  nil , errors .New ("confirmation name does not match application name" )
384+ 		}
385+ 	}
386+ 
342387	rbacObject , rbacObject2  :=  handler .enforcerUtil .GetHelmObjectByClusterIdNamespaceAndAppName (
343388		appIdentifier .ClusterId ,
344389		appIdentifier .Namespace ,
0 commit comments