fix(StakeManager)!: don't allow registration of vaults with incorrect owners #85
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit fixes a bug that anyone can create
StakeVault's for anyone, which enables DDOSing other users.The fix is allowing registration of
StakeVault's inStakeManager.registerVault()only from a trusted address/account, which in our case is going to be theVaultFactory.Previously, we required that the sender needs a trusted codehash (which is any
StakeVaultsource that we whitelist). While this ensures only correctStakeVaults are registered with the system, it doesn't prevent other users from creating vaults for other accounts, as setting theownerof aStakeVaultis configurable in its initialization.The
VaultFactoryensures that the account that creates the vault is also the owner of the vault.BREAKING CHANGES:
StakeVault.register()has been removed. Registration is now entirely done viaVaultFactory.StakeManager.registerVault()now takes the address of the vault to register as argument:Addresses https://github.com/Cyfrin/audit-2025-12-statusl2/issues/1
Closes #72