How developers protect credentials, API keys and access tokens while working remotely

- Reading
- 6 min
A last-minute fix can expose an API key if a configuration file is mistakenly pushed to production. This article shows where keys, tokens and passwords can leak, from Git history to logs and AI assistants. It also explains how remote teams can reduce risk with secrets managers, automated checks in the CI/CD pipeline, minimal permissions and multi-factor authentication. In case of a leak, it advises revoking or replacing the credential and reviewing access logs to assess the impact.
Now imagine a last-minute bug fix from a coworking space gets pushed to production late at night. In the rush to deploy the system, they end up carrying along a configuration file that contains an active API key. Hours later, it is discovered. The real cost isn't the fix itself, but rather figuring out which systems may have been compromised by the key.
Leaks are usually not sophisticated. They happen because of simple mistakes made under pressure. For remote development teams, protecting credentials comes down to consistency and automation.
Where can secrets leak?
API keys, access tokens, SSH keys, cloud credentials and database connection strings can be present throughout your development workflow. If you delete a secret from a file, it may still be present in your repository's Git history.
Other common exposure points include:
- Error reports, debug output and application logs.
- Screenshots, screen sharing and recorded demos.
- Chat messages, ticket comments, shared files.
- Unintentional sharing of local files on a laptop can result in the loss, circulation or decryption of those files.
- There may not be enough protection for sessions or credentials stored in the browser.
- Coding assistants and code commands contain tokens or customer data.
Exposing the key by itself can allow an attacker to access sensitive data, charge improperly, or compromise the customer. The impact depends on the key's permissions and the resources it has access to.
-
Keep secrets out of the code
Never put real passwords directly into the source code. Use environment variables, injected during deployment, or an approved secrets manager to store real passwords.
Don't include files with real values in the check-in. Leave example configuration files with placeholders:
API_KEY=replace_with_your_local_key
DATABASE_URL=your_database_connection_string
This lets your colleagues see your configuration without revealing your login details.
Check out GitHub's guide on keeping your API credentials secure for best practices on storage, access restriction and replacement of compromised credentials.
-
Automate secret detection
Automate this process until it no longer exists. Manual code reviews don't catch everything. Set up pre-commit checks and secret scanning in your CI/CD pipeline to find sensitive credentials before they reach a shared repository.
Periodically, also check your repositories' history. Removing a key from the current version of a file doesn't fully discard it, nor guarantee it has been removed from previous commits. Code reviews and automated security checks are standard practices in the secure software development lifecycle, and you can find additional information at [link to documentation]. iMasters article on secure development and how to identify vulnerabilities during development.
Logs require attention: log sensitive values. Make sure error messages don't reveal credentials.
Check out iMasters' DevSecOps coverage for a lot more information on how to incorporate security into development workflows.
-
Limit each credential's access
Use the principle of least privilege: each key should allow only the minimum set of operations needed for its intended purpose.
Use distinct credentials for each service and environment. A development key should never be used for production access, and no personal credential should be used in a shared environment.
Whenever possible, use short-lived tokens and temporary credentials. This reduces the validity window of a stolen token.
Review permissions periodically, when switching services, and when adding a new team member.
-
Rotate and revoke credentials
Maintain a credential rotation policy that takes into account the credential's purpose, its associated risk level, and its validity period. Change credentials immediately if exposure is suspected.
Remove access for employees leaving the company or contractors whose contracts have ended, and audit any shared accounts they may have had access to.
A documented process makes this information predictable, regardless of who's on call, and easier to remember under the pressure of a busy release.
-
Protect developer accounts and devices
Use a password manager to create strong, unique passwords whenever possible. Enable multi-factor authentication (MFA), using a hardware security key or an authenticator app, if possible.
Use passphrases on SSH keys. Make sure all development laptops are fully encrypted and configured to update and lock automatically when not in use.
The Authentication chapter of CERT.br's Internet Security Handbook (Cartilha de Segurança para Internet), published by Brazil's Computer Emergency Response Team, covers more details on strong passwords, password managers, and how to safely use two-step verification.
-
Share information without revealing secrets
Never share login information in regular chat messages, ticket comments, or shared attachments. Share it through the team's standard secrets management process, and only with those who need it.
Before recording a demo or screen share, check terminals, environment variables, notifications, and browser tabs. This trivial but frequent detail tends to be something you wouldn't want to broadcast.
Apply the same guidance to your AI coding assistants: don't include active API keys, access tokens, or customer data in your prompts. Use only the resources and parameters provided by your organization.
-
Protect your remote network connection
Remote developers might be at home, at a coffee shop, at a coworking office, or at a hotel near the airport.
Yes. It encrypts your device's traffic to the VPN server you're using and doesn't reveal your IP address to the local network where the VPN server is located.
A VPN encrypts your device's traffic to the VPN server and hides your device's IP address from the local network. It may not be able to prevent phishing, malware, or secrets and credentials from being accidentally added to a repository.
To get started quickly, ExpressVPN's guide covers the essentials. Virtual private networks are just one way to protect a connection, not a substitute for secrets management, least-privilege access, or additional authentication.
Your company's security policies should always guide you.
How do you respond when your secret is exposed?
Revoke/rotate the credential and investigate what happened. Review access logs and the action list to check when it may have been used. Notify the team and the person responsible for security about the exposure and, if you have permission, remove it from the code (and from the code history).
Present a scenario. Explain what may be discovered, what will be affected, and how controls will be improved.
Eight habits to adopt this week
- Remove secrets from source code and versioned configuration files.
- Inject them through a secrets manager or a secure environment.
- Enable automatic scanning early on, as well as in CI/CD.
- Use unique credentials for each service and environment.
- Reduce privileges; use short-lived tokens.
- Establish rotation and deprovisioning procedures.
- Enable multi-factor authentication (MFA) and protect laptops/SSH keys.
- Never include secrets in your chats, voice recordings, or AI submissions.
With these controls in place, the developer from the scenario above would have been alerted about the commit before it went to production. Great security doesn't mean never making mistakes. It means designing workflows that tolerate mistakes, so they don't turn into incidents.
Translated from the Brazilian Portuguese original · Read the original