clickEvents are not removed from item entities before they are shown in chat, allowing tricking players
The bug
It appears MC-124024 was fixed for every entity except item entities because they define net.minecraft.world.entity.item.ItemEntity.getName() which does not perform the sanitization.
Reproduction steps
- Use the following command in a command block
/summon item ~ ~1 ~ {PickupDelay:200s,Item:{id:stone,Count:1b},CustomName:"{\"text\":\"Stone\",\"extra\":[{\"text\":\"\\n<RandomGuy> Please click my name to write a message directly to me\",\"hoverEvent\":{\"action\":\"show_text\",\"contents\":\"\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/say This could have been /op RandomGuy!\"}}]}"} - Use the following command to have the name of the armor stand appear in chat
/say @e[type=item,limit=1]
→ It looks like "RandomGuy" wrote something in chat
- Click on "RandomGuy" to reply to them
→
You just executed an arbitrary command