-
Notifications
You must be signed in to change notification settings - Fork 25
Enhance ERC721 Contracts with Base64 Metadata Encoding #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -124,7 +124,7 @@ contract ERC721EthscriptionsCollection is ERC721EthscriptionsEnumerableUpgradeab | |||||
| ',"', | ||||||
| mediaType, | ||||||
| '":"', | ||||||
| mediaUri.escapeJSON(), | ||||||
| mediaUri, | ||||||
|
||||||
| mediaUri, | |
| mediaUri.escapeJSON(), |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,22 +1,22 @@ | ||||||||||
| // SPDX-License-Identifier: MIT | ||||||||||
| pragma solidity 0.8.24; | ||||||||||
|
|
||||||||||
| import "@openzeppelin/contracts/utils/Strings.sol"; | ||||||||||
| import {Base64} from "solady/utils/Base64.sol"; | ||||||||||
| import {LibString} from "solady/utils/LibString.sol"; | ||||||||||
| import "./ERC721EthscriptionsEnumerableUpgradeable.sol"; | ||||||||||
| import "./interfaces/IProtocolHandler.sol"; | ||||||||||
| import "./Ethscriptions.sol"; | ||||||||||
| import "./libraries/Predeploys.sol"; | ||||||||||
| import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; | ||||||||||
|
|
||||||||||
| /// @title NameRegistry | ||||||||||
| /// @notice Handles legacy word-domain registrations and mirrors ownership as an ERC-721 collection. | ||||||||||
| contract NameRegistry is ERC721EthscriptionsEnumerableUpgradeable, IProtocolHandler { | ||||||||||
| using Strings for uint256; | ||||||||||
| using LibString for *; | ||||||||||
|
|
||||||||||
| Ethscriptions public constant ethscriptions = Ethscriptions(Predeploys.ETHSCRIPTIONS); | ||||||||||
|
|
||||||||||
| string public constant PROTOCOL_NAME = "word-domains"; | ||||||||||
| string public constant protocolName = "word-domains"; | ||||||||||
|
||||||||||
| string public constant protocolName = "word-domains"; | |
| function protocolName() public pure override returns (string memory) { | |
| return "word-domains"; | |
| } |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mediaUri should be escaped with .escapeJSON() to prevent JSON injection attacks. Unlike other URIs that are resolved/processed, this is directly embedded in the JSON output without escaping. If the media URI contains characters like quotes or backslashes, it could break the JSON structure.
| mediaUri, | |
| mediaUri.escapeJSON(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Case Sensitivity Breaks Address Validation
The
validate_addressmethod rejects valid EIP-55 checksummed Ethereum addresses containing uppercase hex characters. The regex pattern/\A0x[0-9a-f]{40}\z/only accepts lowercase hex, but Ethereum addresses are case-insensitive and often use mixed-case checksums. Users providing checksummed addresses (e.g.,0xAbCd...) will encounter validation errors even though these addresses are valid. The method already downcases the result, so accepting mixed case input wouldn't affect the output.