Certified Cloud Security Professional (CCSP)Cloud Application SecurityMedium

A cloud-native application uses serverless functions to process incoming data streams. These functions need to interact with a NoSQL database and a third-party API. To adhere to the principle of least privilege, how should access to these resources be managed for each serverless function?

  1. AAssign a unique IAM role with minimal necessary permissions to each serverless function.
  2. BEmbed API keys and database credentials directly into the function's code.
  3. CGrant the default service account full administrative access to all cloud resources.
  4. DUse a single, shared IAM role for all serverless functions in the application.
Show answer & explanation

Correct answer: A. Assign a unique IAM role with minimal necessary permissions to each serverless function.

Assigning a unique IAM role with minimal necessary permissions to each serverless function directly implements the principle of least privilege. This ensures that a function only has access to the specific resources it needs for its task, reducing the blast radius in case of compromise.

Why the other options are wrong

  • B. Embedding credentials in code is a major security anti-pattern, as it exposes secrets and makes rotation difficult.
  • C. Granting administrative access violates the principle of least privilege and creates a significant security risk.
  • D. Using a single shared IAM role for all functions can lead to privilege escalation if one function is compromised, as it would gain access to resources it shouldn't need.

Principle of Least Privilege (PoLP) for Serverless

Applying PoLP in serverless architectures means granting each function only the specific, minimal permissions required to perform its intended task, typically via IAM roles.

  • Reduces the attack surface.
  • Limits the impact of a compromised function.
  • Requires granular access control definitions.

Memory trick: Least Privilege = Least Power.

More Cloud Application Security questions