Keeping keys safe
Store keys in environment variables or a secrets manager, never in public code, front-end JavaScript or emails. Give each key only the permissions it needs, use separate keys for testing and production, and restrict them by domain or IP where possible.
If a key leaks
Revoke it immediately, create a new one, check usage logs for abuse and find how it leaked. Leaked AI and cloud keys are often abused within hours.
Questions, answered
Only keys designed to be public, with restrictions. Secret keys belong on the server.
Whenever someone with access leaves, after any suspected leak, and periodically for sensitive services.