zNS - domain name collisions
Domain registration accepts an empty (zero-length) name. This may allow a malicious entity to register two different NFT's for the same visually indinstinguishable text representation of a domain. Similar to this the domain name is mapped to an NFT via a subgraph that connects parent names to the new subdomain using a domain separation character (dot/slash/…). Someone might be able to register `a.b` to `cats.cool` which might resolve to the same domain as if someone registers `cats.cool.a` and then `cats.cool.a.b`.\\n`0/cats/` = `0xfe`\\n`0/cats/<empty-string/` = `0xfe.keccak("")`\\n```\\nfunction registerDomain(\\n  uint256 parentId,\\n  string memory name,\\n  address domainOwner,\\n  address minter\\n) external override onlyController returns (uint256) {\\n  // Create the child domain under the parent domain\\n  uint256 labelHash = uint256(keccak256(bytes(name)));\\n  address controller = msg.sender;\\n\\n  // Domain parents must exist\\n  require(\\_exists(parentId), "Zer0 Registrar: No parent");\\n\\n  // Calculate the new domain's id and create it\\n  uint256 domainId =\\n    uint256(keccak256(abi.encodePacked(parentId, labelHash)));\\n  \\_createDomain(domainId, domainOwner, minter, controller);\\n\\n  emit DomainCreated(domainId, name, labelHash, parentId, minter, controller);\\n\\n  return domainId;\\n```\\n
Disallow empty subdomain names. Disallow domain separators in names (in the offchain component or smart contract).
```\\nfunction registerDomain(\\n  uint256 parentId,\\n  string memory name,\\n  address domainOwner,\\n  address minter\\n) external override onlyController returns (uint256) {\\n  // Create the child domain under the parent domain\\n  uint256 labelHash = uint256(keccak256(bytes(name)));\\n  address controller = msg.sender;\\n\\n  // Domain parents must exist\\n  require(\\_exists(parentId), "Zer0 Registrar: No parent");\\n\\n  // Calculate the new domain's id and create it\\n  uint256 domainId =\\n    uint256(keccak256(abi.encodePacked(parentId, labelHash)));\\n  \\_createDomain(domainId, domainOwner, minter, controller);\\n\\n  emit DomainCreated(domainId, name, labelHash, parentId, minter, controller);\\n\\n  return domainId;\\n```\\n