Published 11 December 2024
By Siebe Barée
The hidden security risks in your development environment
Development environments are rarely treated as the security risk they are. Why your laptop might be the weakest link in your security chain.
Your production environment might be fortress-level secure, but what about the laptop you're coding on right now? You know, the one with those identical encryption keys, signing secrets, and API tokens that would work just fine in production. The one where you're running npm install on random packages while being logged into AWS.
Production secrets in development: a ticking time bomb
Let's talk about those secrets you're using in development. Not the production database credentials you copied over (that's a different problem), but the actual secrets that are identical between your development and production environments.
Take that JWT signing secret for example. Chances are it's the same in both environments. "Why not?" you might think, "it's just for signing tokens." But when your development environment gets compromised, that attacker now has a valid signing key that works in production.
Or consider that AES encryption key you're using to encrypt sensitive user data. The one that's handling PII or payment details. I bet it's the same across all environments because "it was easier to debug that way." Now your development environment is essentially holding a key that can decrypt production data.
Even seemingly innocent secrets like webhook signing keys or inter-service authentication tokens often end up being identical across environments. We do this because it's convenient, because it makes local testing easier, or simply because we never thought about it.
The real danger isn't just about having production access in development - it's about using secrets that bridge the gap between environments. When an attacker compromises your development environment, they're not just getting access to your test data. They're getting actual keys that work in production.
The solution? Every environment needs its own unique secrets. Yes, even for things like signing keys and encryption keys. Yes, even though it makes debugging slightly harder. Because when your development environment gets compromised (and it will), you want that breach contained to development only.
Remember: any secret that works in both development and production is a bridge between your least secure and most secure environments. And in security, bridges like these are just waiting to be crossed by the wrong people.
Training AI on your secrets
This one's wild. Your AI coding assistant is probably learning from your secrets right now. GitHub Copilot, Jetbrains AI, or whatever else you're using, they're reading and learning everything. And I mean everything.
These AI tools are trained on your code, including .env files. Even worse, they might suggest those secrets in completions for other developers. Imagine your API keys showing up in someone else's autocomplete. What a nightmare.
The fix is straightforward, here's how to do it in Visual Studio Code for GitHub Copilot, go to your .env
file:
Managing secrets across devices
Picture this: you're getting a new laptop. How do you move your secrets over? Let me guess: messages to yourself? Or my personal favorite: a "secure" note in Apple Notes?
This is basically playing hot potato with your company's crown jewels. Every time you transfer secrets unsafely, you're risking them being intercepted or stored in places you can't control.
The right approach? Never store any secrets on your device. Enkryptify offers a CLI tool to run your local environment and fetch secrets on demand fully encrypted and secure. But then you might ask, what about the access token for the CLI? Just revoke the old one and generate a new one. Access tokens are made to be rotated on a regular basis, this is a great time to do it.
Using identical secrets within your team
When credentials are shared, you can't track who did what. When someone leaves the team, everyone needs new credentials. You can't revoke individual access, and worst of all, it teaches developers terrible security habits they'll carry forward. What happens when a developer leaves the company? Do you really revoke and rotate all secrets? My guess is no, and that's a problem.
The solution is simple but often ignored: give each developer their own credentials. Use separate databases or resources per developer when possible. Implement proper secret rotation schedules. Most importantly, track who's accessing what and when.
At Enkryptify we're working on implementing a solution for this problem. We already offer a lot of security improvements, but we're working on a solution to track who's accessing what and when.
Your old projects
Open your projects folder right now. I bet you'll find at least three projects you haven't touched in months (maybe years?). Now open their .env files. Those credentials? They probably still work.
Old projects are like digital landmines waiting to explode. Those forgotten credentials are often still valid. Database connections still work. API keys never expired. Config files still contain sensitive data that could compromise those projects. The solution is regular housekeeping. Audit your old projects monthly and delete local copies of unused projects.
Production access stored locally
We've all done it. That moment when you're debugging a production issue and think, "I'll just grab the production credentials real quick." Next thing you know, you've got AWS keys that could rack up a million-dollar bill sitting in a .env.production file somewhere.
Those production database credentials? Yeah, they could drop every table in your production database just as easily from your laptop as they could from your production servers.
The real solution isn't complex, but it requires discipline. Start by creating separate credentials for development with limited permissions. When you need to debug production, use staging environments that mirror production but can't touch real data.
RATE THIS BLOG POST: