Has anyone had to DM the Giant Coral Snake from 5e SaltMarsh dealing stun damage to undead?

Last night I was DMing my group. They were fighting some undead and the Wizard polymorphed the ranger’s animal companion into the Giant Coral Snake from Ghosts of Saltmarsh. Upon a hit by the coral snake, the target must make a DC 12 CON save or be stunned until it’s next turn. Furthermore, on a failed save the target begins to hallucinate and is affected by short term madness. This lasts for 10 minutes. Ok, so that’s pretty clear. However, since the coral snake was attacking an undead creature I ruled the stun feature, as well as the hallucination, wouldn’t take affect due Undead creatures being immune to poison (or, in this case venom from a coral snake). The stat block didn’t call it poison damage but….well, it had to have been right? My players seemed to accept this line of reasoning but I am curious, has anyone else encountered this?