Ensure that your Oracle Cloud Infrastructure (OCI) IAM policies controlling access to Functions applications follow the principle of least privilege by granting only the minimum permissions necessary to perform specific tasks. Avoid using overly permissive policies such as manage functions-family, which grants comprehensive permissions for both management operations (create, update, delete) and function invocation. Instead, implement granular access controls by separating concerns: use use fn-invocation for invocation-only access, manage fn-app for application management operations, and manage fn-function for function management operations. Additionally, implement resource-level access controls using policy conditions such as target.app.id or target.function.id to restrict access to specific applications or functions, and leverage network source conditions to further limit access based on network origin.
Implementing least privilege IAM policies for Oracle Cloud Infrastructure (OCI) Functions significantly reduces security risks by ensuring users and services have only the permissions they need to perform their designated tasks. Overly permissive policies, such as granting manage functions-family to broad user groups, create unnecessary security exposure by allowing users to not only invoke functions but also create, modify, and delete function applications and functions themselves. This violates the separation of duties principle and increases the risk of accidental or malicious modifications to critical serverless workloads. By using granular policy verbs (use fn-invocation for invocation, manage fn-function for function management, manage fn-app for application management) and implementing resource-level conditions (target.app.id, target.function.id, request.networkSource.name), organizations can enforce precise access controls that align with the principle of least privilege. This approach minimizes the attack surface, prevents privilege escalation, supports compliance requirements for access control, and enables better audit trails by clearly defining who can perform which operations on specific Functions resources.
Audit
To determine if your OCI IAM policies for Functions follow the principle of least privilege, perform the following operations:
Remediation / Resolution
To implement least privilege IAM policies for your Oracle Cloud Infrastructure (OCI) Functions resources, you must update your existing overly permissive policies by performing the following operations:
Important considerations before updating IAM policies:- Plan the new policy structure: Before modifying existing policies, clearly define which user groups need which specific permissions. Separate users into distinct groups based on their roles: function developers (who need management permissions), function invokers (who only need invocation permissions), and administrators (who need full access).
- Identify resource-specific access requirements: Determine whether users need access to all functions in a compartment or only specific functions/applications. Collect the OCIDs of specific functions or applications that should be restricted.
- Test policy changes in a non-production environment first: IAM policy changes can immediately affect user access. Test new policies with a small group of users in a development or test compartment before applying changes to production.
- Document the changes: Maintain clear documentation of policy changes, including the rationale for each permission grant and the expected impact on users.
- Communicate with affected users: Notify users before making policy changes that may reduce their access levels, and provide guidance on requesting additional permissions if needed.
- Policy changes take effect within 10 seconds: Be prepared for immediate impact once policies are saved.
References
- Oracle Cloud Infrastructure Documentation
- Controlling Access to Invoke and Manage Functions
- Creating Policies to Control Access to Network and Function-Related Resources
- Getting Started with Policies
- Managing Policies
- Policy Syntax
- How Policies Work
- Oracle Cloud Infrastructure CLI Documentation
- compartment list
- policy list
- policy get
- policy update