Ensure that your Oracle Cloud Infrastructure (OCI) IAM policies implement resource-level access controls for Functions by using specific application or function OCIDs in policy conditions rather than granting blanket access to all functions in a compartment. Resource-level access controls use policy condition clauses such as where target.app.id = '<application-OCID>' to restrict access to specific applications, or where target.function.id = '<function-OCID>' to restrict access to individual functions. Without these conditions, a policy statement like Allow group FunctionsInvokers to use fn-invocation in compartment cc-functions-compartment grants permission to invoke all functions in the entire compartment, which may include sensitive functions that should have restricted access.
Implementing resource-level access controls for Oracle Cloud Infrastructure (OCI) Functions significantly enhances security by enforcing the principle of least privilege at the individual resource level rather than just at the compartment level. When IAM policies grant function access at the compartment level without resource-specific conditions, users receive permission to invoke or manage all functions within that compartment, regardless of whether they actually need access to all of them. This creates several security risks including unauthorized access to sensitive functions (users invoking functions that process confidential data or perform privileged operations), accidental invocation of critical functions (users mistakenly triggering production functions instead of development functions), cross-team access violations (members of one team accessing another team's functions when both teams share a compartment), and increased blast radius of compromised credentials (stolen credentials can be used to invoke or modify any function in the compartment). By using resource-level conditions with specific function or application OCIDs, organizations can create precise access boundaries that align with actual business requirements and job responsibilities.
Audit
To determine if your OCI IAM policies implement resource-level access controls for Functions, perform the following operations:
Remediation / Resolution
To implement resource-level access controls in your Oracle Cloud Infrastructure (OCI) Functions IAM policies, perform the following operations:
Important considerations before implementing resource-level access controls:- Identify required function access: Before modifying policies, document which user groups need access to which specific functions or applications. Gather the OCIDs of the applications and functions that each group should access.
- Obtain resource OCIDs: You will need the OCIDs of Functions applications and individual functions to use in policy conditions. Use the fn application list and fn function list CLI commands or the Functions console to retrieve these OCIDs.
- Consider application-level vs. function-level restrictions: In most cases, restricting access at the application level using target.app.id is sufficient and easier to manage than function-level restrictions. Use function-level restrictions (target.function.id) only when users need access to specific functions within an application rather than the entire application.
- Plan for multiple resources: If a user group needs access to multiple applications or functions, use the ANY operator in policy conditions to specify multiple OCIDs in a single statement.
- Test policy changes: Resource-level conditions immediately restrict access. Test new policies in a non-production environment first to ensure users can access the functions they need.
- Document OCID mappings: Maintain documentation mapping user groups to the specific application/function OCIDs they can access, as OCIDs are not human-readable.
- Consider policy maintenance: Resource-level policies require updates when new functions or applications are created. Plan a process for updating policies as your Functions environment evolves.
- Administrative access: Ensure that at least one administrator group retains compartment-level access (without resource-level restrictions) to manage all functions and troubleshoot access issues.
References
- Oracle Cloud Infrastructure Documentation
- Controlling Access to Invoke and Manage Functions
- Controlling Access
- Advanced Policy Features
- Policy Syntax
- Details for IAM without Identity Domains
- Managing Policies
- Oracle Cloud Infrastructure CLI Documentation
- compartment list
- policy list
- policy get
- policy update
- application list
- function list