code-423n4 / 2023-04-caviar-findings

9 stars 4 forks source link

Upgraded Q -> 2 from #240 [1683052133668] #979

Closed c4-judge closed 1 year ago

c4-judge commented 1 year ago

Judge has assessed an item in Issue #240 as 2 risk. The relevant finding follows:

[LOW‑11] tokenURI() does not follow EIP-721 The EIP states that tokenURI() "Throws if _tokenId is not a valid NFT", which the code below does not do. If the NFT has not yet been minted, tokenURI() should revert

Proof Of Concept 161: function tokenURI(uint256 id) public view override returns (string memory) { return PrivatePoolMetadata(privatePoolMetadata).tokenURI(id); }

https://github.com/code-423n4/2023-04-caviar/tree/main/src/Factory.sol#L161

17: function tokenURI(uint256 tokenId) public view returns (string memory) {

    bytes memory metadata = abi.encodePacked(
        "{",
            '"name": "Private Pool ',Strings.toString(tokenId),'",',
            '"description": "Caviar private pool AMM position.",',
            '"image": ','"data:image/svg+xml;base64,', Base64.encode(svg(tokenId)),'",',
            '"attributes": [',
                attributes(tokenId),
            "]",
        "}"
    );

    return string(abi.encodePacked("data:application/json;base64,", Base64.encode(metadata)));
}
c4-judge commented 1 year ago

GalloDaSballo marked the issue as duplicate of #44

c4-judge commented 1 year ago

GalloDaSballo marked the issue as satisfactory