This is really not true. A number of the larger digital game sales platforms are questionable - especially the ones that will list several sellers when looking up a specific game. These are known as grey market resellers. Not strictly illegal, but they seem to do minimal checks as to where people obtained the keys they're selling so when buying the keys there's a chance they were sourced illegally. Ask youself, why would these sites need to sell, at an extra cost, a "buyer protection" in case there's a problem with the key? CD Keys are included in that bracket, along with other large players such as Kinguin, G2A and Allkeyshop.
Your best bet for checking a site is 100% legitimate, is checking Publisher sites for authorised retailers.
Or, if you want a quick way to look, any site listed at https://isthereanydeal.com/ is 100% legitimate and not a grey market reseller.