Security for Legal SaaS

Episode 49 · Module 10 · Infrastructure

Cloud IAM and Least Privilege

19 May 2026 · 9:33 · Security for Legal SaaS

9:33 9:33

Every cloud resource your legal SaaS platform depends on — databases, storage buckets, message queues, AI services, compute instances — is protected by an Identity and Access Management (IAM) system. IAM determines who can access what, under what conditions, and with what permissions. It is the control plane for your entire cloud infrastructure. The theory is straightforward: every principal (user, service, application) should have only the minimum permissions required to perform its function. This is the principle of least privilege, which we first discussed in Episode 8 in the context of database access.

Today’s Lesson

Security for Legal SaaS — Episode 49: Cloud IAM and Least Privilege

That Service Account Has Owner Permissions Because Someone Needed It Once

Every cloud resource your legal SaaS platform depends on — databases, storage buckets, message queues, AI services, compute instances — is protected by an Identity and Access Management (IAM) system. IAM determines who can access what, under what conditions, and with what permissions. It is the control plane for your entire cloud infrastructure.

The theory is straightforward: every principal (user, service, application) should have only the minimum permissions required to perform its function. This is the principle of least privilege, which we first discussed in Episode 8 in the context of database access. Applied to cloud infrastructure, it means your document processing service should be able to read from the document storage bucket and write to the processed output bucket — and nothing else. Not access the database. Not read other services' logs. Not modify IAM policies.

The reality is different. Research on cloud security patterns 1 consistently finds that over-permissioned cloud roles are the norm, not the exception. A developer needed broad access during initial setup, granted their service account Owner or Administrator permissions, moved on to the next task, and never scoped it down. Now every compromised container runs as God.

How Cloud IAM Works — Principals, Policies, and Permission Evaluation

All three major cloud providers — AWS, Google Cloud (GCP), and Microsoft Azure — use the same conceptual model, with different terminology:

Concept AWS GCP Azure
Identity IAM User, IAM Role Google Account, Service Account Azure AD User, Managed Identity
Permission IAM Policy (JSON) IAM Role binding Role Assignment (RBAC)
Resource scope Account-level, resource-level Project, folder, organisation Subscription, resource group
Machine identity IAM Role (assumed by EC2/Lambda) Service Account Managed Identity

The permission evaluation chain follows a common pattern: when a principal attempts an action on a resource, the IAM system checks all applicable policies. In AWS, this means evaluating identity-based policies, resource-based policies, permission boundaries, session policies, and service control policies. A single `Deny` anywhere in the chain overrides all `Allow` statements.

Google Cloud's service account best practices 2 emphasise that "service accounts are not just a mechanism for authentication — they define the permissions envelope for everything running under that identity." Every container, every serverless function, every background job running as a given service account inherits all of that account's permissions.

Service Accounts and Workload Identity — Machines Need Identities Too

In a legal SaaS platform, most API calls are made not by humans but by services: the document parser calling the storage API, the AI engine calling the model endpoint, the billing service writing to the database. Each of these services needs an identity to authenticate, and that identity must be tightly scoped.

Common anti-pattern: A single "app" service account shared by all microservices, with permissions to access every resource in the project. If any one service is compromised, the attacker inherits the combined permissions of every service. This is the blast radius problem — the scope of damage from a single breach.

The correct approach is one service account per service, each with the minimum permissions required:

Service Needs Should NOT Have
Document Parser Read from upload bucket, write to parsed output bucket Database access, IAM admin
AI Engine Call model API, read from parsed output bucket Direct storage access, billing data
Billing Service Write billing records to database Document access, model API access
Audit Logger Write to audit log storage Read any other data
Admin API Read/write user management database Direct access to document storage

The Cyscale IAM best practices guide 3 recommends creating service accounts with names that describe their purpose (`sa-document-parser`, `sa-billing-writer`) and reviewing their permissions quarterly.

Workload Identity Federation

Modern cloud platforms offer workload identity — a mechanism where your Kubernetes pods, CI/CD pipelines, or serverless functions receive cloud credentials automatically, without storing long-lived keys. GCP Workload Identity Federation 4, AWS IAM Roles for Service Accounts (IRSA), and Azure Workload Identity all eliminate the need for service account key files — which are long-lived credentials that can be stolen, copied, and reused from anywhere.

Temporary Credentials and Role Assumption

Long-lived credentials — API keys, service account key files, access keys that never expire — are a liability. If stolen, they provide indefinite access. If leaked to a log file, a configuration dump, or a developer's notebook, they remain valid until manually revoked.

The principle-of-least-privilege guide from Inventive HQ 5 emphasises temporary credentials as a core IAM practice:

For legal SaaS platforms, the rule is simple: if a credential doesn't have an expiration time, it's a risk. Temporary credentials that automatically rotate eliminate an entire class of vulnerabilities — stolen keys, leaked credentials, forgotten access.

Over-Permissioned Cloud Roles — The Real-World Pattern

Security Boulevard's analysis of permission creep 6 documents the pattern: permissions accumulate over time. A developer needs access to debug a production issue — they're granted a broad role. The issue is resolved, but the permissions remain. Six months later, that developer's account has accumulated permissions across eight projects, including resources they no longer work with.

The statistics are stark: 23% of all cloud security incidents stem from misconfigurations 6, with overly permissive access policies being a leading cause. Permission creep — the gradual accumulation of excessive and unused cloud permissions — creates a dangerous attack surface that is difficult to manage manually.

Detecting Over-Permission

Each cloud provider offers tools to identify unused and excessive permissions:

Provider Tool What It Shows
AWS IAM Access Analyzer 7 Unused permissions, excess privileges, external access findings
GCP IAM Recommender 8 "Excess / Total permissions" — permissions the principal has but hasn't used
Azure Microsoft Permissions Management 9 Over-provisioned identities, unused permissions, permission creep alerts

The GoCodeo guide to implementing least privilege 10 recommends a practical workflow: deploy with minimal permissions, let the application run for 30-90 days, then use IAM analyzers to identify permissions that were never used. Remove them. This "right-sizing" approach avoids the upfront difficulty of predicting exact permission needs.

Practical approach: Start with the broadest role that lets the service function (to avoid blocking development), then right-size after 30-90 days using IAM analyzers. This is pragmatic least privilege — you'll never get permissions perfect on the first try, but you should never leave them un-reviewed.

Privilege Escalation Inside Cloud Environments

IAM misconfigurations are not just about over-permission. They can be active attack paths. An attacker who compromises a service with permission to modify IAM policies can grant themselves any permission — effectively escalating from a limited role to full administrator access.

The shared responsibility model analysis 11 highlights that cloud providers secure the platform, but IAM configuration is entirely the customer's responsibility. Common privilege escalation paths include:

For a legal SaaS platform, audit IAM-modifying permissions with special attention. Very few services should have the ability to change IAM policies. Separate the "create infrastructure" role from the "run application" role — and ensure the running application cannot modify its own permissions.

Just-in-Time (JIT) Access

For human operators who occasionally need elevated permissions — debugging a production issue, performing a database migration, responding to a security incident — just-in-time access provides temporary privilege elevation with automatic expiration.

Automated remediation approaches 1 can automatically revoke unused permissions, tighten overly broad IAM policies, or trigger JIT access workflows. The pattern:

  1. Operator requests elevated access through a ticketing system
  2. Approval workflow (peer review, manager approval, or automated policy check)
  3. Temporary role granted — typically 1-4 hours
  4. All actions during the elevated session are logged
  5. Role automatically revokes at expiration

This eliminates standing privileges — permissions that are always active, waiting to be exploited. For legal SaaS platforms handling privileged communications, JIT access is both a security control and an audit trail for regulator inquiries: who had admin access, when, for how long, and what did they do?

Key takeaway: Cloud IAM is the gatekeeper for your entire infrastructure. Over-permissioned service accounts are the most common and most dangerous misconfiguration in cloud environments. Use one service account per service, scope permissions tightly, prefer temporary credentials over long-lived keys, use IAM analyzers to detect permission creep, and implement JIT access for human operators. If a single compromised container can access every resource in your cloud project, your IAM configuration is your biggest vulnerability — not your application code.

What's Next

Next episode, we shift from infrastructure to the people who build on it — developer workstation security. Your production servers are hardened. Your developer's laptop has Slack, Chrome, and an SSH key to every environment.

Sources & references

  1. Rolling Out/Enforcing Least Privilege in AWS/GCP/Azure — P0 Security
  2. Best Practices for Using Service Accounts Securely — Google Cloud
  3. IAM Best Practices for AWS, Google Cloud, and Azure — Cyscale
  4. Workload Identity Federation — Google Cloud
  5. Principle of Least Privilege: A Complete Guide for Cloud Security — Inventive HQ
  6. Don't Let Your Cloud Security Catch a Bad Case of Permission Creep — Security Boulevard
  7. IAM Access Analyzer — AWS Documentation
  8. IAM Recommender — Google Cloud
  9. Identity and Access Security Recommendations — Microsoft Defender for Cloud
  10. Implementing Least Privilege in Cloud and DevOps Workflows — GoCodeo
  11. Cloud Security: The Shared Responsibility Model — Ambacia
  12. Microsoft Cloud Security Benchmark — Privileged Access