No shade, I like a lot of her music, but in the music industry you can change a few words or request that the song be a bit different in some aspect, or add a couple harmonies that weren't in the original music sheet and it counts as a writing credit.
Writing credits do not mean that you are an actual songwriter though. Songwriters are people who write entire songs, who are able to create art in the form of a song from scratch, without someone else literally writing an entire song for them and then just coming in and changing a couple of things. In the industry both things are considered "songwriting" as far as credits and royalties go, but it does not mean they are the same in practical terms or what is commonly understood by most people as songwriting. This applies to many other pop stars too.
Considering the fact that Rihanna has co-writers on every single track she has a credt in, puts out albums every year while also touring and promoting full time (leaving her little to time write songs from scratch), and has never really spoken about songwriting, it's not ludicrous to assume she might have just changed a few things (also check out the demo for Rude Boy by Ester Dean which is up on YouTube...which is exactly the same as the original, yet Rihanna has a credit on it).