Anything shipped to a browser is public whatever you call it. A Firebase web API key or a Stripe publishable key is meant to be visible and is protected by rules and origin restrictions, not by secrecy. A key that must stay hidden simply cannot go in client-side code.
When a secret does leak, rotate it rather than removing the file. Rewriting history does not help once a key has been cloned, pushed to a fork or indexed. Rotation is the only action that actually invalidates what leaked.
Updated August 2026