Definitely the one who hasn't had several songwriting-credit-stealing accusations or covers a song but only adds one phrase to become a head writer. Because of that, I'll go with Rihanna as the better writer.
Beyonce is heavily involved in all her albums(from songwriting to vocal arrangements). The same can't be said for Rihanna, who claims to pick songs like she picks shoes.