mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-10 14:48:15 -05:00
fix: [C4-109-L02] Unlink could be called for any unlinked handles by passing zero
This commit is contained in:
@@ -176,6 +176,9 @@ contract TokenHandleRegistry is ITokenHandleRegistry {
|
||||
}
|
||||
|
||||
function _unlink(uint256 handleId, uint256 profileId, address transactionExecutor) private {
|
||||
if (handleId == 0 || profileId == 0) {
|
||||
revert RegistryErrors.DoesNotExist();
|
||||
}
|
||||
if (
|
||||
ILensHandles(LENS_HANDLES).exists(handleId) &&
|
||||
ILensHandles(LENS_HANDLES).ownerOf(handleId) != transactionExecutor &&
|
||||
|
||||
@@ -112,16 +112,16 @@ contract TokenHandleRegistryTest is BaseTest {
|
||||
assertEq(tokenHandleRegistry.resolve(handleId), profileId);
|
||||
assertEq(tokenHandleRegistry.getDefaultHandle(profileId), handleId);
|
||||
|
||||
vm.expectRevert(RegistryErrors.NotLinked.selector);
|
||||
vm.expectRevert(RegistryErrors.DoesNotExist.selector);
|
||||
vm.prank(otherAddress);
|
||||
tokenHandleRegistry.unlink(handleId, 0);
|
||||
|
||||
vm.expectRevert(RegistryErrors.NotLinked.selector);
|
||||
vm.expectRevert(RegistryErrors.DoesNotExist.selector);
|
||||
vm.prank(otherAddress);
|
||||
tokenHandleRegistry.unlink(0, profileId);
|
||||
|
||||
console.log('0, 0');
|
||||
vm.expectRevert(RegistryErrors.NotLinked.selector);
|
||||
vm.expectRevert(RegistryErrors.DoesNotExist.selector);
|
||||
vm.prank(otherAddress);
|
||||
tokenHandleRegistry.unlink(0, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user