I wouldn’t apply any chemical to a firearm that wasn’t designed to be applied to a firearm.
But that’s just me.
“WD-40 has been used in the gun industry for many years. It is not only safe to use on your gun, but comes highly recommended by many experts in the industry due to its cleaning, rust preventing, moisture displacing, penetrating and lubricating properties.”
https://www.wd40.com/news/in-the-news/wd-40-can-be-an-effective-maintenance-tool-for-gun-owners