Skip to content

Commit

Permalink
Merge pull request lavanet#1267 from lavanet/CNS-903-audit-buyer-over…
Browse files Browse the repository at this point in the history
…writing-user-subscription

CNS-903-audit-buyer-overwriting-user-subscription
  • Loading branch information
Yaroms authored Mar 3, 2024
2 parents d0327da + bc55345 commit d7d075b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions x/subscription/keeper/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ func (k Keeper) CreateSubscription(
// If the plan index is different - upgrade if the price is higher
// If the plan index is the same but the plan block is different - advice using the "--advance-purchase" flag
if plan.Index != sub.PlanIndex {
if sub.Creator != creator && sub.Consumer != creator {
return utils.LavaFormatWarning("only the consumer or buyer can overwrite the subscription plan.", nil)
}
err := k.upgradeSubscriptionPlan(ctx, &sub, &plan)
if err != nil {
return err
Expand Down

0 comments on commit d7d075b

Please sign in to comment.