If there is enough insulation to stop the mains, and the heatsink is earthed, then I think it is legal.
A single fault would not cause danger. If the earth wire came disconnected, there could be a bit of leakage, but if it wasn't enough to trip the ELCB with the earth connected, it wouldn't be enough to cause danger. Alternatively, if the insulation broke done, there would be fault to earth and the fuse or ELCB would blow.
The minimum spacing, suitable insulation gap etc. are all for non-earthed appliances.