Skip to main content

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

Critical

Address

Compliance, Security

Compliance 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

Using Console

Here’s how to remediate “OCI IAM Policies Should Not Grant Manage/Use On All Resources” using the OCI Console.

1. Identify Overly Broad Policies

  1. Sign in to the OCI Console.
  2. Open the navigation menu (☰) → Identity & SecurityIdentityPolicies.
  3. In the Scope selector at the top left, check both:
    • Tenancy level (root)
    • Each compartment where you define policies
  4. 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>
    You can quickly find them by:
    • Clicking a policy name
    • Using browser search (Ctrl+F / Cmd+F) for all-resources.
These are the ones violating the rule.

2. Plan Least-Privilege Replacement

For each policy statement using manage all-resources or use all-resources, decide:
  1. Which principal actually needs access?
    • Group? Dynamic group? User?
  2. Which services/resources do they really need?
    Replace all-resources with 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:
    Useful resource-type families:
    • instance-family
    • volume-family
    • virtual-network-family
    • object-family
    • database-family
    • stream-family
    • functions-family
    • etc.
  3. 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:
  1. In Identity → Policies, click the policy name.
  2. Click Edit Policy.
  3. In the Statements text box:
    • Remove or change statements containing:
      • manage all-resources
      • use 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 of in tenancy)
    Example transformation: Before:
    After (more appropriate for monitoring use cases):
    (Adjust to your actual needs; often read/inspect is enough for monitoring.)
  4. Click Save Changes.

4. Validate Access Still Works

  1. Identify a test user in the affected group (e.g., member of monitoring-ops).
  2. Log in as that user (or use Auth token + CLI to test).
  3. Confirm they can:
    • Perform their required monitoring tasks (view metrics, alarms, logs, etc.).
    • Cannot create/delete unrelated resources (e.g., VCNs, instances, buckets).
If something fails due to missing permission, add only the minimal additional statements needed.

5. Clean Up and Standardize

  1. Repeat the above steps for any remaining manage/use all-resources policies.
  2. Document:
    • Which groups have which policies.
    • Which compartments those apply to.
  3. Going forward:
    • Use compartment + resource-family + minimal verb for all new policies.
    • Avoid all-resources entirely 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.
Below is a step‑by‑step remediation using OCI CLI to fix policies that grant 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 config already 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

1. Identify Problem Policies

List policies in the compartment:
For each policy, inspect its statements:
Look for statements like:
Note the 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 alarms only:
Optionally restrict metrics further by namespace:
You will replace the manage/use all-resources statements with such specific ones.

3. Export Existing Policy for Backup

For each affected policy:
Keep this as backup.

4. Build a Cleaned‑Up Policy Definition (Locally)

Open the backup JSON file and extract / edit the statements array.For example, if original statements were:
Change to something like:
Save this minimal JSON file (for update) as updated-statements.json:
Alternatively, just keep the array and use --statements directly (see next step).

5. Update the Policy Using OCI CLI

Option A – Pass --statements directly (simpler):
Note the quoting: ' around JSON, escaped ' inside the where clause.Option B – Use a JSON file:Create policy-update.json:
Then:
This replaces the entire statements array, removing manage/use all-resources.

6. Verify the Updated Policy

Ensure:
  • No statement includes manage all-resources or use 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:
  1. Create a new Monitoring policy:
  1. Edit the old policy to remove MONITORING_GROUP lines, 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.
Below is a practical way to detect and remediate OCI IAM policies that grant 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):
If you genuinely need to manage alarms:
Replace:
  • <group-name> with the actual group name used in the overbroad policy.
  • <compartment-name> with the correct compartment.
You will be replacing overbroad statements like:
with the minimal set above.

2. Install and Configure the OCI Python SDK

Set up your ~/.oci/config or environment variables (tenancy, user OCID, key, region).Example ~/.oci/config:

3. Python Script: Find and Fix Overbroad Policies

This script:
  1. Lists policies in a given compartment or tenancy.
  2. Looks for statements containing manage all-resources or use all-resources.
  3. For statements containing a target group you care about, it:
    • Removes the overbroad lines.
    • Appends Monitoring-only statements.
  4. Updates the policy.
Important:
  • 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

  1. Fill in:
    • COMPARTMENT_OCID
    • TARGET_GROUPS
  2. Start with DRY_RUN = True.
  3. Review the script’s console output for each policy.
  4. Once satisfied, set DRY_RUN = False and run again.
  5. Test that Monitoring users can still perform required actions (view metrics/alarms, manage alarms if needed).
If you share an example of one of your current overbroad policy statements, I can give you the exact replacement statements and a tighter filter for the script.
Changing the 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.