# Cloud access review: narrow a policy without breaking the task

> Review an illustrative S3 reader role, separate policy intent from observed activity, and design positive and negative permission checks.

Canonical: https://codelivly.com/blog/cloud-access-review

| | |
|---|---|
| Category | Cloud security |
| Author | Codelivly team |
| Reading time | 7 min |

A policy contains `"Action": "s3:*"`. Removing the wildcard may look like an obvious improvement. The harder questions are what the workload actually needs, which other policies affect it, and how you will check that the change preserves the required task.

We will review an illustrative reporting job that reads one object from an S3 bucket. The exercise moves from a written requirement to a candidate policy and a verification plan. It is intentionally small enough to reason about without creating a cloud account or changing a real workload.

 **Paper exercise**

The role and bucket names below are placeholders. No cloud commands were executed and no access was verified. The JSON is a teaching example, not a complete production policy. Codelivly browser rooms do not necessarily provision an AWS account; use the environment specified by your exercise.

## Define the work that must remain possible

The sample reporting job runs as `report-reader`. It retrieves exactly one known object: `daily/summary.csv` in `codelivly-training-example`. It does not discover objects by listing the bucket, upload a result or delete old reports. We assume the object does not require a customer-managed KMS key for this deliberately simplified example.

| Question | Scenario answer |
|---|---|
| Who makes the request? | The report-reader role's session. |
| What action is needed? | Read a known object's contents. |
| Which resource? | daily/summary.csv in the named training bucket. |
| What is not required? | Listing, writing, deleting or reading other objects. |
| What is still outside the example? | Role assumption, network controls, other policies and real workload behavior. |

If the owner cannot confirm the required object or whether listing is needed, keep those fields unresolved. A security change based on a guessed requirement may break the job or retain unnecessary access. Ask for the code path or workload documentation that explains how the request is made.

## Read the existing statement carefully

Suppose the sample identity policy contains the following statement. Its scope is much wider than the stated read task.

```json
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": "s3:*",
    "Resource": "*"
  }]
}
```

Write a precise observation: “This statement broadly allows S3 actions across applicable resources.” Avoid “the role can do anything in AWS.” The service prefix limits the statement to S3, and the effective result still depends on the rest of the authorization context.

[AWS policy evaluation documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html) explains how policy types combine and how explicit denies affect access. A single allow statement does not establish every effective permission. Gather applicable identity and resource policies, boundaries and organizational controls before making a real access decision.

## Propose the smallest statement for the sample requirement

For the known-object read in this paper exercise, the candidate identity policy is:

```json
{
  "Version": "2012-10-17",
  "Statement": [{
    "Sid": "ReadDailySummary",
    "Effect": "Allow",
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::codelivly-training-example/daily/summary.csv"
  }]
}
```

The action and resource now match the stated object read. This statement does not grant bucket listing. S3 bucket and object operations use different resource scopes; consult [AWS's S3 identity-policy examples](https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-policies-s3.html) for their distinction and the additional permissions a console workflow may require.

Do not copy this candidate into production and declare the role restricted. Another attached policy or resource policy might still grant broader access. If the job actually reads changing keys, a single fixed key may also be too narrow. The purpose of the candidate is to make the assumed requirement explicit enough to review.

### What changes when the requirement changes?

Imagine the job starts reading a date-named object each day. You now need to establish how it learns the key. If another component supplies the exact name, listing may still be unnecessary. If it searches a prefix, listing becomes a separate requirement with a separate test. Record that change rather than responding to an error by restoring `s3:*`.

The same reasoning applies to encryption, cross-account access and additional output files. Each adds a question to resolve. Do not hide those dependencies behind the phrase “least privilege”; name the task and the permission it needs.

## Separate configuration evidence from activity evidence

A policy describes permission. An activity record describes an observed request. Neither alone tells the whole story. A successful read shows that one request worked in its recorded context; it does not prove the role cannot read something else. An unused permission may still be available.

For a training review, keep these two evidence sets separate:

| Evidence | Question it helps answer | Limit |
|---|---|---|
| Attached policies and applicable constraints | What access might this identity receive? | A partial inventory can miss another grant or deny. |
| Workload requirement and implementation | Which requests are needed for the job? | Documentation can be incomplete or stale. |
| Available request/activity records | Which requests were observed? | Coverage, retention and logging configuration limit what is visible. |
| Authorized verification results | Did specific allowed and denied cases behave as expected? | A finite test set does not cover every resource or condition. |

If a supplied exercise has no object-read activity records, write that limitation. Do not assume that an empty log view proves no reads occurred. Confirm which event types the exercise actually provides before using absence as evidence.

## Design a verification matrix before the change

A test plan needs both a required operation that should succeed and unrelated operations that should fail. Otherwise, a policy that denies everything may appear successful simply because it blocks unwanted access.

| Test under report-reader | Expected result | Why it matters |
|---|---|---|
| Read daily/summary.csv | Allow | The workload retains its stated function. |
| Read a different controlled test object | Deny | The known-object boundary is checked. |
| List the training bucket | Deny | Discovery is outside this scenario's requirement. |
| Write or delete a disposable test object | Deny | Mutation is outside the read-only requirement. |

This table is a proposed test plan. In an actual authorized sandbox, use disposable fixtures and the intended role, document the policy version and retain the observed response. Do not test destructive actions against valuable data just to prove that a deny exists. For this article, none of the rows has been executed.

Define a rollback before making a live change: the approved previous configuration, who can restore it, and which workload failure should trigger that decision. A denied request can reveal a missed requirement; it should lead to investigation rather than an automatic broad grant.

## Write a review another person can challenge

```text
Requirement
report-reader retrieves daily/summary.csv by its known key.
No listing, write or delete requirement is documented.

Observation
The supplied identity statement allows s3:* on Resource *.
Other applicable policies have not been supplied.

Proposal
Replace that statement with the specific GetObject grant shown above,
subject to owner confirmation and review of all applicable policies.

Verification plan
Check the required read and the negative cases in the matrix.
Use controlled test data and the intended identity.

Status
Paper review only. No policy deployed; no requests executed.
```

This note makes the change reviewable. Someone can challenge the fixed-key assumption, point out an additional grant or identify a missing encryption dependency. “IAM hardened” would conceal those important details.

 **Your exercise**

Change the requirement so the job writes a result to a separate output prefix. Add the required operation to the matrix, identify which old assumption is no longer valid, and explain why the original read-only policy is insufficient. Keep the input and output scopes separate in your reasoning.

If identities, resources and actions are unfamiliar, begin with [Cloud Platform Fundamentals](https://codelivly.com/learning-paths/cloud-platform-fundamentals). Then choose a published exercise from the [cloud security overview](https://codelivly.com/cloud-security-course) and repeat the review using its actual evidence. Preserve the distinction between a proposed check and a check you performed.
