I’m somewhat hesitant to recommend filing, as I have no idea how much material you’d need to remove to get to a flat surface. It’d be entirely possible to remove enough to weaken the bar in an important way.
I’d probably settle for something milder. Steel brush, light sanding. The rust removing chemical of your choice.
If you want to get rid of the pitting, consider using a filler before paint.