Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Are Serverless Function Permissions?

A serverless function has two permission sets: the identity it uses to call other services, and the policy controlling who may invoke it. Getting either wrong converts a small bug into a cloud breach.

Illustration for the cybersecurity term Serverless Function Permissions
Home / Blog / Cybersecurity Terms / What Are Serverless Function Permissions?
17 November 2026

What Are Serverless Function Permissions?

What Are Serverless Function Permissions?

Every serverless function carries two distinct sets of permissions, and conflating them causes most of the trouble. The first is the identity the function runs as — an execution role on AWS Lambda, a managed identity on Azure Functions, a service account on Google Cloud Functions — which determines what the code can reach. The second is the policy governing who or what may invoke the function in the first place. The first decides the damage; the second decides who gets to cause it.

The Execution Identity

When a function calls another service, it does so with credentials the platform injects at runtime. Those credentials are short-lived, which is genuinely better than an embedded access key, but their scope is whatever the role says. A function that processes uploaded invoices and holds s3:* on Resource: "*" can read every bucket in the account, including the one holding database backups.

Default behaviour makes this worse on some platforms than others. On Google Cloud, functions historically defaulted to the App Engine or Compute Engine default service account, which carries the Editor role across the project — close to administrative access for anything that bothers to use it. On AWS, the managed AWSLambdaBasicExecutionRole is appropriately narrow, but teams routinely attach broad managed policies alongside it because determining the exact actions needed is tedious.

The consequence is predictable. An injection flaw, a vulnerable dependency, or a server-side request forgery in a function with a narrow role produces a contained incident. The same flaw in a function with a wide role produces a breach of the account. This is the mechanism behind a great many cloud incidents: the application weakness was ordinary, and the identity attached to it was not.

The Invocation Policy

Resource-based policies control the other direction. On Lambda, every event source — API Gateway, an S3 bucket, EventBridge, SNS — needs an explicit permission statement naming it. Two mistakes recur:

The equivalent on Azure is the function access key and the authorisation level set per trigger; on Google Cloud it is the roles/cloudfunctions.invoker binding, where granting it to allUsers has the same effect as a public URL.

Writing Narrow Policies Without Guessing

The honest difficulty is that nobody knows which actions a function needs until it has run. Three approaches make this tractable:

  1. Generate from observed activity. IAM Access Analyzer can produce a policy from CloudTrail history for a role, which gives you a real starting point rather than a guess. Run the function through its full workflow in a test account first, including error paths.
  2. Deploy permissively in development, never in production. Use the unused-access findings in Access Analyzer, or the equivalent recommender on Google Cloud, to remove permissions that have not been exercised in ninety days.
  3. Constrain with conditions and boundaries. Scope resources to specific ARNs and prefixes, add conditions on tags or source VPC endpoints, and apply a permissions boundary so a developer who can edit the role cannot widen it beyond a ceiling. Service control policies at organisation level provide the outer limit — see our entry on multi-account architecture.

One function, one role. Sharing a role across several functions means the union of everything any of them needs, which is how roles become administrative by accretion.

The Adjacent Mistakes

Permissions sit next to a few other habits worth correcting at the same time. Secrets placed in environment variables are visible to anyone with lambda:GetFunctionConfiguration and appear in the console, in deployment artefacts, and often in logs; a secrets manager reference costs little and removes the exposure. Logging permissions should be mandatory rather than optional, because a function with no write access to its log group is invisible during an investigation. And functions deployed into a VPC inherit security group rules that frequently allow far more egress than the workload needs, which is what lets an attacker exfiltrate once they have the credentials.

Reviewing What You Already Have

For an existing estate, start by listing every function with its role and sorting by the breadth of that role. Wildcard actions, wildcard resources, and attached administrator policies go to the top. Separately, list every function with a public URL or an unconditioned resource policy, since those are the entry points. Where the two lists intersect you have an internet-reachable function with wide permissions, and that is where to spend the first week.

This work belongs alongside broader serverless security and identity and access management practice. If you want the attack paths traced rather than the policies merely listed, our cloud security services test exactly that.

FAQ – Frequently Asked Questions

Why Is the Default Service Account a Problem?

On Google Cloud the default compute and App Engine service accounts have historically held the Editor role across the whole project, which permits reading and modifying almost every resource in it. A function left on that identity hands project-wide access to anyone who compromises the code. Create a dedicated service account per function with only the bindings it needs, and disable automatic role grants for default accounts.

Are Lambda Function URLs Safe to Use?

They are safe when the authentication type is AWS_IAM and the resource policy names specific principals. With AuthType set to NONE the endpoint is publicly invokable by anyone who learns the URL, with no gateway in front to provide throttling, request validation, or a web application firewall. For anything internet-facing that matters, put API Gateway or CloudFront in front of the function instead.

How Do I Find Over-Permissive Function Roles?

Start with policy analysis: list roles containing wildcard actions, wildcard resources, or attached administrator policies, which most cloud posture tools will do for you. Then use access advisor data or unused-access findings to compare granted permissions against what each role has actually used over the last ninety days. The difference between the two is usually most of the policy.

Should Secrets Go in Environment Variables?

No. Environment variables are readable through the management API by anyone who can describe the function, appear in infrastructure-as-code repositories, and often end up in logs or error output. Store the value in a secrets manager or parameter store, grant the execution role permission to read that one secret, and fetch it at cold start with caching. Rotation then happens in one place.

Related Terms

You May Be Interested In These

What Is DNS Log Analysis?

Cybersecurity Terms

17 November 2026

What Is DNS Log Analysis?

Read More
What Is Bettercap?

Cybersecurity Terms

17 November 2026

What Is Bettercap?

Read More
How the NotPetya Attack Worked

Cybersecurity Terms

17 November 2026

How the NotPetya Attack Worked

Read More