Thanks for the comments. Yeah, I don't know much about plastics. The rivets look like the best solution though. I don't take the lights out often since I carry the bike inside with me at work. If it becomes loose then yeah, I'll add some glue and re-rivet it.
Such a little thing and yet so much engineering