Maybe just eat the bugs? Serves 'em right. That said, I’ve had a couple of times over 30 years where something–little moths, what not–got going, and I didn’t like that and threw everything out because I couldn’t be certain where their home bases were.
I do put rice in bags in the freezer for a week or so if I buy in quantity. That seems to keep things under control.