Sui.

Publication

Partagez vos connaissances.

DuAn.
Jan 24, 2025
Questions et Réponses avec des Experts

Securing shared objects for specific package interaction

We are developing a package that interacts with another package using a shared object. This shared object can be updated by any module, which might open it up to security risks. How can we restrict edits so that only a specific package can update it?

  • Sui
2
5
Partager
Commentaires
.

Réponses

5
fomo on Sui.
Sep 7 2025, 11:51

You'll want to implement an admin or policy capability pattern. Create a unique capability object within the package that should have exclusive update rights. Then, have all the update functions for the shared object require a reference to this capability object as an argument. This way, only the owner of that specific capability can call those update functions, effectively restricting edits to your package.

4
Commentaires
.
farshad.
Jan 25 2025, 03:41

Pour vous assurer que seul un package spécifique peut mettre à jour un objet partagé, vous pouvez utiliser des modèles tels que l'expéditeur ou le contrôle des capacités. L'une des solutions consiste à implémenter un modèle de capacité, dans lequel vous autorisez les mises à jour en fonction de la propriété d'un objet. Vous pouvez également créer une liste de contrôle d'accès (ACL) pour autoriser uniquement certaines adresses à interagir avec les méthodes de votre package. Ces méthodes sont détaillées dans des ressources telles que la documentation sur les modèles de capacité et la règle de liste de refus, qui peuvent être consultées ici et ici.

1
Commentaires
.
dhaholar.
Aug 26 2025, 22:48

To make sure only a specific package can update a shared object in Sui Move, you need to build in access control directly into your smart contract logic. One way to do this is by using a capability pattern, where you create a special object that acts like a permission slip—only the package that holds this object can make changes. You can also check the sender’s address during a transaction and allow updates only if it matches the expected package address. Another option is to include an access control list inside the shared object itself, listing which addresses are allowed to make edits. These methods help you lock down the object so that other modules or packages can’t tamper with it.

0
Commentaires
.

Connaissez-vous la réponse ?

Veuillez vous connecter et la partager.