CloudAcademia
EN

Cloud Computing · Module 07 · Identity and Access Management in the Cloud

Quiz: Cloud IAM: Who Can Do What

QuizIntermediateQuestions: 10Markdown

Showing raw Markdown: the renderer could not load.

## Questions

### 1. A new engineer's script fails with `AccessDenied` when it uploads to a bucket. She suggests creating a new access key for her user and trying again. Why will this not fix the problem?
*Objective: 1. Explain the building blocks of cloud IAM: principals (users, groups, roles, service accounts), authentication versus authorization, and how a request is evaluated.*

- A) A new key is signed with a different algorithm, which the bucket rejects.
- B) `AccessDenied` means the key has expired, and new keys expire as fast as old ones.
- C) The cloud already authenticated her; no policy allows the upload, so a new key for the same user is denied the same way.
- D) `AccessDenied` means the request was modified on its way to the cloud.

### 2. A command returns this identity. What does it tell you?
*Objective: 1. Explain the building blocks of cloud IAM: principals (users, groups, roles, service accounts), authentication versus authorization, and how a request is evaluated.*

```json
{
  "UserId": "AROAEXAMPLEID:deploy-42",
  "Account": "123456789012",
  "Arn": "arn:aws:sts::123456789012:assumed-role/deployer/deploy-42"
}
```

- A) The caller is an IAM user named `deployer`, using a password.
- B) The caller is a session of the role `deployer`, named `deploy-42`, using temporary credentials, and the role's policies apply.
- C) The caller is the root user of account `123456789012`.
- D) The caller is a group named `deploy-42`, so every member acts at once.

### 3. A user's policies contain the two statements below. What happens when she requests `s3:GetObject` on `docs-bucket/hr/salaries.csv`, and on `docs-bucket/public/a.txt`?
*Objective: 2. Read and write JSON access policies with actions, resources, effects and conditions, and predict the result when allow and deny statements overlap.*

```text
{ "Effect": "Allow", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::docs-bucket/*" }
{ "Effect": "Deny",  "Action": "s3:GetObject", "Resource": "arn:aws:s3:::docs-bucket/hr/*" }
```

- A) Both are allowed, because the broader allow covers the whole bucket.
- B) Both are denied, because any deny in the bucket blocks every request to it.
- C) `hr/salaries.csv` is allowed and `public/a.txt` is denied, because the more specific statement is ignored.
- D) `hr/salaries.csv` is denied and `public/a.txt` is allowed, because the explicit deny wins only where it matches.

### 4. This policy is attached to a user. She runs `aws s3 ls s3://docs-bucket` and gets `AccessDenied`. What is the cause?
*Objective: 2. Read and write JSON access policies with actions, resources, effects and conditions, and predict the result when allow and deny statements overlap.*

```json
{
  "Version": "2012-10-17",
  "Statement": [
    { "Effect": "Allow", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::docs-bucket/*" }
  ]
}
```

- A) `ListBucket` applies to the bucket ARN `arn:aws:s3:::docs-bucket`; the resource with `/*` names objects, so the statement never matches.
- B) Identity policies must contain a `Principal` element, which is missing.
- C) `ListBucket` is not a valid action, so the whole policy is ignored.
- D) The `Version` date must be changed to the current year.

### 5. A team adopts attribute-based access control (ABAC): a user may start a VM only if the VM's `project` tag equals the user's `project` tag. Which new risk must the team control?
*Objective: 3. Apply the principle of least privilege and compare role-based (RBAC) and attribute-based (ABAC) access control.*

- A) ABAC policies cannot contain `Deny` statements.
- B) Whoever can edit the tags can give themselves access, so tag-editing permissions become sensitive.
- C) ABAC makes multi-factor authentication impossible.
- D) ABAC needs a separate long-lived access key for each project.

### 6. A new service needs to read objects from one bucket. Which way of granting access best follows the principle of least privilege?
*Objective: 3. Apply the principle of least privilege and compare role-based (RBAC) and attribute-based (ABAC) access control.*

- A) Grant administrator access until launch day, then remove it when someone has time.
- B) Grant `s3:*` on the bucket, because the service only uses storage.
- C) Grant only `s3:GetObject` (and `s3:ListBucket` if needed) on that bucket, and add permissions only when a specific denied request shows they are required.
- D) Reuse the policy of the busiest team, so there are fewer policies to maintain.

### 7. A deployment pipeline in a code hosting platform must deploy to your cloud account. Which design is safest?
*Objective: 4. Explain temporary credentials and federation (SAML 2.0, OpenID Connect) and why they are safer than long-lived access keys.*

- A) Trust the platform as an OpenID Connect identity provider, and let the job exchange its short-lived token for a role whose trust policy accepts only that repository and branch.
- B) Create an access key for a deployment user, store it as a pipeline secret and rotate it once a year.
- C) Put one access key on every build runner so jobs do not need configuration.
- D) Give the pipeline the root user's key, so deployments never fail for lack of permissions.

### 8. Which statement about federation standards is correct?
*Objective: 4. Explain temporary credentials and federation (SAML 2.0, OpenID Connect) and why they are safer than long-lived access keys.*

- A) OAuth 2.0 alone proves who the user is, so OpenID Connect adds nothing to it.
- B) With SAML 2.0, the cloud receives and stores the user's password from the identity provider.
- C) Federation requires creating a long-lived access key in the cloud for every federated user.
- D) OpenID Connect adds an authentication layer to OAuth 2.0 and issues signed JWT ID tokens, while SAML 2.0 uses signed XML assertions; the cloud trusts the signature, not a password.

### 9. During an access review you find an access key for an employee who left six months ago, and the audit log shows it was used yesterday from an unfamiliar network. What do you do first?
*Objective: 5. Assess common IAM mistakes (wildcard policies, leaked keys, unused accounts, no MFA) and how to detect them.*

- A) Wait for the key's scheduled 90-day rotation, because rotation fixes leaks.
- B) Delete the code repository where the key might have been published, and consider it solved.
- C) Deactivate or delete the key at once, then review the audit log for everything it did, including any new users, keys or policies it created.
- D) Change the former employee's directory password.

### 10. Your security team wants to learn quickly when a leaked access key is used from an unexpected country. Which control gives that information?
*Objective: 5. Assess common IAM mistakes (wildcard policies, leaked keys, unused accounts, no MFA) and how to detect them.*

- A) A narrower policy on the key, which blocks every unexpected use.
- B) Audit logs of API calls (who, what, source address), stored safely and monitored with alerts.
- C) Rotating the key every year.
- D) Requiring MFA for programs that use the key.

---

## Answer key

<details>
<summary>Show answers</summary>

| # | Answer | Explanation |
|---|---|---|
| 1 | C | `AccessDenied` is an authorization result: the identity was recognized, but no policy allows the action. A new key for the same user carries the same permissions. The key, its signature and the integrity of the request are fine. |
| 2 | B | `assumed-role/deployer/deploy-42` is a session of the role `deployer` named `deploy-42`, with temporary credentials. The role's permissions apply, not those of the person who assumed it. It is neither a user, the root user nor a group. |
| 3 | D | Statements are evaluated per request. The deny matches `hr/*` and wins there; for `public/a.txt` only the allow matches, so it is allowed. A deny does not affect resources it does not match, and a broad allow cannot override a matching deny. |
| 4 | A | `ListBucket` is a bucket-level action, so its resource is the bucket ARN without `/*`. The statement is valid but never matches the request, and the default deny applies. Identity policies must not contain `Principal`, and `2012-10-17` is the correct version. |
| 5 | B | ABAC decisions depend on attributes, so anyone who can change a tag can change the outcome. Tag changes must be restricted and audited. ABAC supports `Deny`, works with MFA and needs no extra keys. |
| 6 | C | Least privilege starts from nothing and adds only the actions and resources the task needs, guided by the denied requests or the audit log. Administrator access "for now", `s3:*` and copied policies all leave far more access than needed. |
| 7 | A | OIDC federation gives the job temporary credentials with no stored secret, and the trust policy limits who can assume the role. A stored key (even rotated yearly) can leak and works anywhere; shared runner keys and root keys are worse. |
| 8 | D | OIDC is the identity layer on OAuth 2.0, which alone is about delegated authorization. Both OIDC and SAML pass a signed token or assertion, so the cloud never sees a password and needs no per-user access key. |
| 9 | C | Contain first: a key that is being used now must be disabled immediately. Then use the audit log to see what the attacker did and what persistence (new keys, users, policies) they created. Rotation schedules and deleting a repository do not stop active use, and a directory password does not affect an access key. |
| 10 | B | Audit logs record who called what, from which address, and alerts turn them into detection. A narrower policy and rotation limit damage but do not tell you about use, and programs cannot use MFA. |

</details>