From f9dbf41e277c5c77932d71131d30dbc2c3c13975 Mon Sep 17 00:00:00 2001 From: Poorna Date: Thu, 15 Feb 2024 13:03:40 -0800 Subject: [PATCH] sr: add validation to disallow updating bandwidth limit on self (#19062) --- cmd/site-replication.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/site-replication.go b/cmd/site-replication.go index 55e9dd5c0..382dec852 100644 --- a/cmd/site-replication.go +++ b/cmd/site-replication.go @@ -3980,6 +3980,9 @@ func (c *SiteReplicationSys) EditPeerCluster(ctx context.Context, peer madmin.Pe } if peer.DefaultBandwidth.IsSet { + if peer.DeploymentID == globalDeploymentID() { + return madmin.ReplicateEditStatus{}, errSRInvalidRequest(fmt.Errorf("invalid deployment id specified: expecting a peer deployment-id to be specified for restricting bandwidth from %s, found self %s", peer.Name, globalDeploymentID())) + } pi.DefaultBandwidth = peer.DefaultBandwidth pi.DefaultBandwidth.UpdatedAt = UTCNow() successMsg = fmt.Sprintf("%s\n- default bandwidth %v for peer %s", successMsg, peer.DefaultBandwidth.Limit, peer.Name)