Our key was hardcoded in the mobile app for 8 months and rate limiting on the gateway caught it
We had the same API key baked into our iOS build since January, and nobody flagged it until a partner noticed odd traffic from a single IP in Dallas. What actually worked was putting a simple spend cap and per-key rate limit on the gateway instead of trying to strip the key from the app overnight. Curious if anyone here has dealt with key rotation on shipped apps without forcing a full update.
The "spend cap and per-key rate limit" move is exactly what saved us too, way faster than trying to yank the key out of a shipped build. We did the same thing and then added a server side flag so the app fetches a new key on launch, which kept old versions working while we phased them out over a couple months. Rotating the key server side first (using the rate limit as a cushion) bought us enough time to avoid forcing an update.