Federated engineering org with an over-broad tenancy policy
Northwind has an OCI tenancy with 14 compartments under the root: Prod-App, Prod-DB, Prod-Network, Shared, three NonProd stacks, Sandbox, and four project compartments. 420 engineers authenticate through Microsoft Entra ID and are synchronized by SCIM into one OCI identity domain. During a pilot, a tenancy-level policy granted Allow group AllEngineers to manage all-resources in tenancy. Audit now shows engineers can delete production Object Storage buckets and modify VCN security lists. A dynamic group rule, ALL {instance.compartment.id = 'ocid1.compartment.oc1..sandbox'}, was copied into production and a second rule matches every instance in the tenancy; instances in Sandbox can read a bucket in Prod-DB because the dynamic group has a tenancy-wide read buckets policy. A local break-glass user still has an API key created 400 days ago and no MFA. CI/CD uses instance principals and must keep deploying. The CISO wants least privilege, no user policies, and a tested emergency path.
1. Redesign the policy and group model so engineers get only the access their role needs, while CI/CD keeps working. Be specific about compartment placement, policy verbs, and why you would not simply add deny rules.
Read the worked answer
OCI IAM policies are allow-only; there is no deny rule to subtract from the tenancy-wide grant. The fix is to remove the root policy and rebuild access around role groups and compartment boundaries. Create groups such as ProdAppDev, ProdDba, NetOps, SecurityAudit, and SandboxUsers. Put policies on the narrowest compartment that contains the resources: for example, Allow group ProdAppDev to manage instances in compartment Prod-App and Allow group ProdDba to manage db-systems in compartment Prod-DB. Use read or inspect for audit and use where a role only needs to attach resources; reserve manage for owners. Remember that policies inherit downward, so a policy placed on Prod-App also affects its subcompartments. That is why the tenancy-level policy was so dangerous: it applied everywhere. For CI/CD, do not create user API keys. Use a dynamic group with a narrow matching rule, such as ALL {instance.compartment.id = 'ocid1.compartment.oc1..prod-app'} plus a production tag, and grant only the deployment actions it needs in the target compartment. If CI/CD runs as a resource principal, scope those policies similarly. Separating production and non-production groups prevents a Sandbox compromise from becoming a production incident.
2. Fix the dynamic-group design and the Object Storage access path. What matching rules and policy scope would you use, and what would you check in Audit?
Read the worked answer
Split the dynamic group into at least ProdAppInstances and SandboxInstances. The production rule should match only the production compartment, for example ALL {instance.compartment.id = 'ocid1.compartment.oc1..prod-app'}, optionally combined with a defined tag such as tag.Environment.value = 'Prod'. The sandbox rule should match only the sandbox compartment. Never use a rule that matches every instance in the tenancy, and do not rely on a copied sandbox OCID. Then replace the tenancy-wide read buckets policy with a policy in the bucket's compartment that grants read objects only to ProdAppInstances; if the instance only needs one bucket, place the policy where that bucket lives and avoid granting manage buckets. Sandbox instances should not receive any prod bucket policy. In Audit, filter on the instance-principal OCID and inspect eventName for GetObject or ListObjects, targetCompartment, and the bucket name. Check principalName to confirm whether the caller is the dynamic group or a user. Also review dynamic-group membership changes and any policy changes in the last 90 days. This shows whether the fix removed the path or merely changed the caller.
3. Design the break-glass path. Include authentication, credential storage, alerting, and how you would retire the old API key without locking out operations.
Read the worked answer
Keep a break-glass path that does not depend entirely on Entra ID, because an IdP outage must not prevent recovery. Create a small BreakGlassAdmins group in the OCI identity domain with two named users, require MFA through a sign-on policy, and restrict sign-in by network perimeter if the business allows it. Grant that group manage all-resources in tenancy, but only that group. Store any emergency API key in OCI Vault, rotate it on a defined schedule, and keep the private key offline in a sealed process. Do not leave the old 400-day-old key active while you build the new path. First create the new key and update the runbook and automation that might use it; then disable the old key, watch for 401 errors and Audit events for 24-48 hours, and delete it after the agreed window. Add Events and Cloud Guard alerts for break-glass sign-in, group membership changes, and tenancy-level policy changes. Test the path quarterly by using it to perform a harmless audited action, then rotate the credential. The goal is a narrow, monitored exception, not a permanent shared admin key.