DatingDapp

First Flight #33
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: low
Invalid

Incorrect Token URI Format due to Default _baseURI Implementation

Summary

The contract's implementation of the token URI relies on _baseURI(), which by default returns an empty string. This can lead to an improperly formatted token URI, potentially causing issues when interfacing with wallets or platforms that expect a specific URI format (e.g., a data URI prefix).

Vulnerability Details

  • Default Behavior: OpenZeppelin’s ERC721 implementation of _baseURI() returns an empty string. As a result, when concatenating the Base64-encoded JSON metadata, the expected prefix (such as "data:application/json;base64,") is missing.

  • Formatting Issue: The lack of the correct prefix can cause external systems and clients to misinterpret the token metadata or fail to load it altogether.

  • Assumption Mismatch: Developers might assume that _baseURI() is correctly configured, leading to integration issues if the token URI is not in the expected format.

Impact

  • Interoperability Problems: Wallets, marketplaces, or other platforms expecting a properly formatted data URI may not display the NFT metadata correctly.

  • User Experience: This could result in a degraded user experience where NFT details (like profile information) are not properly rendered.

  • Maintenance Confusion: Future maintainers might overlook this subtle issue, leading to persistent integration bugs.

Tools Used

  • Manual Code Review

  • Analysis of OpenZeppelin ERC721 documentation and source code

Recommendations

  • Override _baseURI(): Modify the _baseURI() function to return the appropriate prefix for on-chain metadata. For example:

    function _baseURI() internal pure override returns (string memory) {
    return "data:application/json;base64,";
    }
Updates

Appeal created

n0kto Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

invalid_baseURI_not_override

`_baseURI` can remains empty, the token URI will have a valid JSON. Rest can be handled in the app interface.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.