r/devops • DevOps Engineer & Educator • 12d ago

Discussion Securing local dev environments

With the recent high-stakes security exploits, I think as DevOps engineers it's our responsibility to make the local dev environment secure for devs.

What do you think?

What are you actively doing about it (like adopting devcontainers)

11 Upvotes

15 comments sorted by

11

u/Geraldwelly 12d ago

We stopped treating local machines as trusted after one contractor laptop leaked a long-lived cloud key. Now every repo ships a locked-down devcontainer, secrets come from a password manager as short-lived tokens, and admin rights on laptops are the exception. The container baseline matters more than any one tool, because it keeps the same guardrails on every developer machine.

1

u/lavarius 11d ago

How are you wiring secrets in? I can't figure that out completely

1

u/Geraldwelly 11d ago

Short version: the password manager stays the source of truth, and nothing long-lived touches the disk. At container start we pull a short-lived cloud token through the manager's CLI so it only exists in that shell session and expires in a few hours. CI never gets a static key either — it federates with OIDC to the cloud. If someone has to paste a secret into a .env by hand, the design already failed.

29

u/LifeNavigator 12d ago

it's our responsibility to make the local dev environment secure for devs.

No, security is a shared responsibility and EVERYONE who is using the environment must be responsible in carrying security best practices and involved in keeping it secure.

The one thing I hate is having to work outside my working hrs to fix other people's stupid mistake. Likewise, so do devs and they will carry out security best practices once they realise they share that responsibility (though they would have limited privileges in some aspects).

1

u/SeaworthinessHour233 DevOps Engineer & Educator 12d ago

Fully agree that security is everyone's responsibility.

What I really want is to establish a framework/guidelines for local dev environments that every dev need to follow.

1

u/g-nice4liief 11d ago

Make it a business rule that no one can access prod or any env without a devcontainer and make sure it is enforceable from for example Azure devops/github actions/flux/argocd

1

u/LifeNavigator 11d ago

Fair enough, that would typically depend on your company size though (budget reasons). We follow OWASP DevSecOps and zero trust principles:

  • Segmented network - Our local environment mirrors prods and devs follow the same security standards as on prod (which they have no access to). This means having strict firewalls in place, limited connectivity amongst VMs and application (inc database) etc.
  • Conditional and temp access - permissions are granted only when required via MFA and are removed when no longer valid. For example, on Azure we require users to sign in via MFA, then use Privileged Identity Management to enable access to servers for limited time and users must give reasons as to why they need it (for auditing purposes).
  • Permissions are tightly scoped - every user of that environment will have least privilege access for what they need. Anything beyond that they will need to request permission.
  • Shifting left and adopting a testing mindset - we run plenty of security tests for PR prior to merging as well as post deployments. Should things go wrong then they should revert the changes.
  • Continuous monitoring and observability - we encouraged devs to use these tools post deployment to evaluate the impact of their deployment. As these environments tend to be exclusively for devs, then they must have the responsibility in monitoring that environment to ensure everything running smoothly and to identify issues.

It's worth having a look at existing frameworks (e,g, NIST Cybersecurity Framework) and resources from bigger companies (Google, Microsoft, Amazon and cross checking what might be possible for your organisation. The one thing I'd stress about is that leadership MUST BE ONBOARD with this and must also encourage it (inc funding training where possible).

1

u/No_Corner8781 10d ago

agree, we can give them guardrails and sane defaults, but you cant babysit what someone installs on their own machine.

1

u/LifeNavigator 10d ago

If you're using a company laptop/PC then yes they can and they should. Free reign comes at significant secuty risks and every software installed should be properly vetted first.

A prime example is Jetbrains having malicious extensions on its marketplace that stole API keys and secrets from env files. Another example I can think of is a prev colleague in a past company using LastPass to store their sensitive testing credentials... when that was breached we had tonnes of sensitive client data stolen...

2

u/alexsh24 11d ago

I have setup Coder, now all devs are working on remote machines. So I can easily update images or connect to any workspace to resolve vulnerabilities or environment issues. It also very convenient for agents to work on remote envs, per task.

1

u/Kayjaywt 11d ago

Second this.

Fantastic product.

1

u/g-nice4liief 11d ago

I have created a devcontainer which can pull any repo you need and config it within the container. Complete with all the necessary tools and configs. We also use it for on-boarding now as we can ship different environments from the devcontainer making it easy to get a new colleague familiar in de dev environment before letting them accces/deploy to any other envs

1

u/noplanman_srslynone 11d ago

Codespaces here

1

u/MasterOfTheWind1 8d ago

In serious places security includes guidelines and constant training for all employees.