More Info:
IAM policies should not grant manage or use permissions on all-resources. Broad resource access violates least-privilege principles and magnifies the impact of credential compromise.Risk Level
CriticalAddress
Compliance, SecurityCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- Cloudanix Best Practice
- DPDPA
- Digital Operational Resilience Act (EU)
- Essential 8
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Here’s how to remediate “OCI IAM Policies Should Not Grant Manage/Use On All Resources” using the OCI Console.
If you share one of your current policy statements, I can rewrite it into a least‑privilege version tailored to your exact monitoring use case.
1. Identify Overly Broad Policies
- Sign in to the OCI Console.
- Open the navigation menu (☰) → Identity & Security → Identity → Policies.
-
In the Scope selector at the top left, check both:
- Tenancy level (root)
- Each compartment where you define policies
-
In the policy list, look for policies containing statements like:
... to manage all-resources in tenancy... to manage all-resources in compartment <name>... to use all-resources in tenancy... to use all-resources in compartment <name>
- Clicking a policy name
- Using browser search (Ctrl+F / Cmd+F) for
all-resources.
2. Plan Least-Privilege Replacement
For each policy statement usingmanage all-resources or use all-resources, decide:-
Which principal actually needs access?
- Group? Dynamic group? User?
-
Which services/resources do they really need?
Replaceall-resourceswith more specific verbs and resource-types, e.g.: Common replacements:- Instead of:
allow group app-admins to manage all-resources in compartment app-compartment - Use something like:
instance-familyvolume-familyvirtual-network-familyobject-familydatabase-familystream-familyfunctions-family- etc.
- Instead of:
-
Scope to the smallest compartment possible.
Avoid “in tenancy” unless truly necessary; prefer “in compartment<name>”.
3. Edit the Policy in the Console
For each problematic policy:- In Identity → Policies, click the policy name.
- Click Edit Policy.
-
In the Statements text box:
- Remove or change statements containing:
manage all-resourcesuse all-resources
- Replace them with:
- Specific resource families (e.g.,
instance-family,database-family) - Appropriate verb (
inspect,read,use,manage) - Narrower scope (
in compartment <name>instead ofin tenancy)
- Specific resource families (e.g.,
After (more appropriate for monitoring use cases):(Adjust to your actual needs; often read/inspect is enough for monitoring.) - Remove or change statements containing:
- Click Save Changes.
4. Validate Access Still Works
- Identify a test user in the affected group (e.g., member of
monitoring-ops). - Log in as that user (or use Auth token + CLI to test).
- Confirm they can:
- Perform their required monitoring tasks (view metrics, alarms, logs, etc.).
- Cannot create/delete unrelated resources (e.g., VCNs, instances, buckets).
5. Clean Up and Standardize
- Repeat the above steps for any remaining
manage/use all-resourcespolicies. - Document:
- Which groups have which policies.
- Which compartments those apply to.
- Going forward:
- Use compartment + resource-family + minimal verb for all new policies.
- Avoid
all-resourcesentirely unless under a controlled break-glass/admin account.
If you share one of your current policy statements, I can rewrite it into a least‑privilege version tailored to your exact monitoring use case.
Using CLI
Using CLI
Below is a step‑by‑step remediation using OCI CLI to fix policies that grant
For each policy, inspect its statements:Look for statements like:Note the
Manage alarms only:Optionally restrict metrics further by namespace:You will replace the
Keep this as backup.
Change to something like:Save this minimal JSON file (for update) as Alternatively, just keep the array and use
Note the quoting: Then:This replaces the entire
Ensure:
If you paste a sample of your current problematic policy statements, I can give you an exact
manage/use on all-resources, and replace them with least‑privilege Monitoring permissions.Assumptions (adjust for your tenancy):- You have OCI CLI configured (
oci setup configalready done). - You know:
- Compartment OCID where the policy lives:
COMPARTMENT_OCID - Group name that should have Monitoring access:
MONITORING_GROUP - Namespace you want to allow access to (optional):
my_app_ns
- Compartment OCID where the policy lives:
1. Identify Problem Policies
List policies in the compartment:POLICY_OCID of each policy that has such statements.2. Decide Desired Least‑Privilege Monitoring Access
Typical least‑privilege examples for Monitoring:Read metrics only:manage/use all-resources statements with such specific ones.3. Export Existing Policy for Backup
For each affected policy:4. Build a Cleaned‑Up Policy Definition (Locally)
Open the backup JSON file and extract / edit thestatements array.For example, if original statements were:updated-statements.json:--statements directly (see next step).5. Update the Policy Using OCI CLI
Option A – Pass--statements directly (simpler):' around JSON, escaped ' inside the where clause.Option B – Use a JSON file:Create policy-update.json:statements array, removing manage/use all-resources.6. Verify the Updated Policy
- No statement includes
manage all-resourcesoruse all-resources. - Monitoring group has only the specific Monitoring permissions you want.
7. (Optional) Split Broad Policies into Separate Monitoring‑Specific Policy
Instead of mixing Monitoring and non‑Monitoring permissions in a single policy, you can:- Create a new Monitoring policy:
- Edit the old policy to remove
MONITORING_GROUPlines, keeping only non‑Monitoring ones.
If you paste a sample of your current problematic policy statements, I can give you an exact
oci iam policy update command tailored to your case.Using Python
Using Python
Below is a practical way to detect and remediate OCI IAM policies that grant
If you genuinely need to manage alarms:Replace:with the minimal set above.
Set up your
manage/use on all-resources, and then restrict them to Monitoring-only permissions using Python and the OCI SDK.1. Decide What “Monitoring-Only” Access Should Be
Typical least-privilege Monitoring permissions look like:Read-only monitoring (view metrics and alarms):<group-name>with the actual group name used in the overbroad policy.<compartment-name>with the correct compartment.
2. Install and Configure the OCI Python SDK
~/.oci/config or environment variables (tenancy, user OCID, key, region).Example ~/.oci/config:3. Python Script: Find and Fix Overbroad Policies
This script:- Lists policies in a given compartment or tenancy.
- Looks for statements containing
manage all-resourcesoruse all-resources. - For statements containing a target group you care about, it:
- Removes the overbroad lines.
- Appends Monitoring-only statements.
- Updates the policy.
- Run in dry-run mode first (set
DRY_RUN = True) to see what would change. - Adjust
TARGET_GROUPS,MONITORING_STATEMENTS, and compartments to match your environment.
4. Steps to Use Safely
- Fill in:
COMPARTMENT_OCIDTARGET_GROUPS
- Start with
DRY_RUN = True. - Review the script’s console output for each policy.
- Once satisfied, set
DRY_RUN = Falseand run again. - Test that Monitoring users can still perform required actions (view metrics/alarms, manage alarms if needed).
Using Terraform
Using Terraform
statements of oci_identity_policy updates the policy in place and does not force replacement of the resource.For verification, terraform plan should show the existing oci_identity_policy with its statements being updated from manage/use all-resources to the more specific Monitoring permissions shown above, with no other changes.
