From 06417d67a3fd7ce7e4634fabd39ec01781224cc3 Mon Sep 17 00:00:00 2001 From: stadolf Date: Thu, 3 Oct 2024 20:59:02 +0200 Subject: [PATCH] ensure that the authorizer only lets the caller pass Signed-off-by: stadolf --- src/IPNFT.sol | 3 +-- test/IPNFT.t.sol | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/IPNFT.sol b/src/IPNFT.sol index 4005f02d..76ef64a0 100644 --- a/src/IPNFT.sol +++ b/src/IPNFT.sol @@ -23,7 +23,7 @@ import { IReservable } from "./IReservable.sol"; \▓▓▓▓▓▓\▓▓ \▓▓ \▓▓\▓▓ \▓▓ */ -/// @title IPNFT V2.4 +/// @title IPNFT V2.5 /// @author molecule.to /// @notice IP-NFTs capture intellectual property to be traded and synthesized contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReservable, UUPSUpgradeable, OwnableUpgradeable, PausableUpgradeable { @@ -188,7 +188,6 @@ contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReser (bool success,) = _msgSender().call{ value: address(this).balance }(""); require(success, "transfer failed"); } - /// @inheritdoc UUPSUpgradeable function _authorizeUpgrade(address /*newImplementation*/ ) diff --git a/test/IPNFT.t.sol b/test/IPNFT.t.sol index 85607c27..19facf23 100644 --- a/test/IPNFT.t.sol +++ b/test/IPNFT.t.sol @@ -229,6 +229,11 @@ contract IPNFTTest is IPNFTMintHelper { (uint8 v, bytes32 r, bytes32 s) = vm.sign(deployerPk, authMessageHash); bytes memory authorization = abi.encodePacked(r, s, v); + //the signoff only allows alice to call this + vm.startPrank(charlie); + vm.expectRevert(IPNFT.Unauthorized.selector); + ipnft.amendMetadata(1, "ipfs://QmNewUri", authorization); + vm.startPrank(alice); vm.expectEmit(true, true, false, false); emit MetadataUpdate(1);