Why is it so hard for people to write least privilege policies

im actually losing my mind doing security audits this week. looking at our internal accounts and it feels like every single dev just slaps s3:* or literal AdministratorAccess on their roles because they don’t want to spend 5 minutes debugging permissions

Its not even that hard to figure out tbh with access analyzer but people are just incredibly lazy when there’s a deadline.

I was just reviewing a stack that an external dev team cisin handed over to us for a web portal and every single lambda execution role was perfectly scoped down to the exact DynamoDB arn and specific s3 prefix. It literally brought a tear to my eye

meanwhile my own senior engineers will deploy a random internal slack bot with full root-level ec2 permissions “just in case”. How do you guys actually enforce least privilege without the whole engineering department hating your guts?

Dev environment probably should have more permissions than needed. It’s just just a minute headache.

Staging should be like production, and permissions should be least privileged. Use automated reviews to enforce.

The question you should ask yourself is why devs are able to manage IAM permission by themselves.

I think from my experience, people just don’t know what they are doing.

And it’s easier to give all access instead of being security conscious, at least for all the fellow ai coders out there

centralize your IAM functions and don’t put it on the people using the access to design the policy.

It’s pretty much like anything else, where if there is no incentive to do the right thing (carefully think through and limit permissions) and only incentives to do the wrong thing (get that Jira ticket resolved faster by just giving it wildcard permissions), people will choose to do the wrong thing.

You’d need to solve that problem, but if you can’t, then it’ll likely always be the case that someone else will be cleaning up after it.

Not trying to defend an obviously bad practice, but out of the 3 major providers, AWS seems to be the hardest one to nail “least privilege” just right.

I 100% agree with this post and my actions as a developer are completely indefensible. That being said, I have been these devs dozens of times. I get so fuckin’ tired of permission errors when I’m debugging shit that after 3 or 4 iterations of Terraform edits, CI pipeline builds and re-deploys, I put my “Fuck It, Chuck It” hat on and just throw out a bunch of * permissions just to get the goddamned thing to fucking work one goddamned time before I have to sign off for the day.

Kids, don’t be like me. Be like OP.

Trying to find out exactly what permissions something needs is painful even with CloudTrail turned on and lots of patience. It doesn’t help that even the quick setup / wizard methods via the GUI often don’t have correctly scoped resources.

I think the most common cause for this is where you have Operations folks responsible for IAM for other teams and they are motivated to avoid the embarrassment of delivering a role that doesn’t work so they just wildcard everything. It’s the tale as old as time – misaligned incentives.

Cutting corners because you’re under pressure from an upcoming deadline is not the same thing as being lazy.

That’s because of Identity policies. The other providers are basically only resource policies.

Lazy

What? No it shouldn’t if you are using IaC dev, stating, prod should all have the same permissions.

IAM ownership should be with Sec teams. Put in guardrails.

Promoting engineers who care about security and giving them a mandate to shame folks who don’t. That and making managers accountable for those roles.

What? you don’t know what servers you call when you build an app? I could see this being the case possibly for a vendor app who didn’t give you, for whatever reason, the right IAM policy their app needs but if you build an app you should know what permissions it needs.

The answer is in u/zugzwangister 's comment. Dev environment should be looser, with the understanding that the blast radius is bigger and everyone is trading off safety for convenience. Staging/pre-prod should be tight like prod.

Not excusing bad practices, but you will understand this better if you know that debugging permissions errors usually isn’t just a 5-minute fix. There are many cases that require non-trivial or indirect permissions that ultimately wind up getting resolved via trial-and-error deployment via CloudFormation/CDK. This can be an extremely tedious and frustrating process and I’ve lost too many days to count stuck in this horrible loop where each iteration can take 10-15 minutes, depending on the stack/app/etc. The worst part is that sometimes you wind up needing to give iam:* or an effective equivalent (e.g. for CFN-affiliated bootstrapping roles) that wind up negating much of the benefit of following least privilege in the first place. The end result is it’s one of the single most - if not the most - exhausting, infuriating, and demoralizing tasks in cloud development.

Generally speaking, the meta has shifted away from role-level least privilege and towards account-level managed via Organizations and SCPs. Least privilege should absolutely still be followed intra-account to the extent that it is possible, but account-level isolation and SCPs should be your first line of defense.

the thing that actually ends the fight is to stop hand-writing policies: let devs run wide in a dev account, then point iam access analyzer at that role’s cloudtrail and have it generate the scoped policy from what the role really called. you enforce the tight version only at the staging/prod boundary in ci, and sit a permission boundary or scp over everything so a lazy s3:* or AdministratorAccess literally can’t resolve to root even when someone slaps it on. people don’t resent you for automating the annoying part, they resent you for making them guess arns by hand under a deadline.