IAM Policy Check

Reads an AWS IAM or S3 bucket policy back in plain words and flags grants far wider than intended, such as a bucket made public.

StopsHelps catch an S3 bucket made public by a policy

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/iam-policy-check.json

The files land in your project. They're yours to edit.

Usage

iam-policy-check-usage.tsx
import { IamPolicyCheck } from "@/components/ui/iam-policy-check"

return <IamPolicyCheck label="acme-uploads bucket policy" defaultValue={POLICY} accountId="111122223333" />

What it catches

  • Full-admin and service:* action wildcards, and Resource "*"
  • Principal "*" that S3 Block Public Access treats as public, including conditions that don't narrow it
  • Public reads and writes on a bucket
  • Allow with NotAction, and NotPrincipal traps
  • iam:PassRole on every role, with an iam:PassedToService fix

Props

IamPolicyCheck props
PropTypeDefault
value

Controlled policy JSON.

string—
defaultValue

Initial JSON when uncontrolled.

string""
onValueChange

Called with the new text on every edit or fix. Fixes re-format the JSON with 2-space indents.

(value: string) => void—
accountId

Your 12-digit AWS account ID; enables "Limit to account" on public principals.

string—
orgId

Your AWS Organizations ID (o-…); enables "Limit to my organization" when no account ID is given.

string—
usedActions

Actions the principal really uses (e.g. from IAM Access Analyzer); enables replacing wildcards with them.

string[]—
policyType

What the policy is attached as; "scp" treats Allow "*" on "*" as the FullAWSAccess baseline.

"identity" | "resource" | "scp"—
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{line}`, `{detail}`, `{count}`, `{account}`, `{n}` are filled in.

Partial<IamPolicyCheckMessages>—

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Text area has a label, aria-invalid when errors exist, and is described by the status
  • Status uses role=status; icons are aria-hidden
  • Each issue has a labelled button that selects its line; focus returns to a nearby control after a fix

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

This is a UX guard rail. Enforce on the server: Validate policies with IAM Access Analyzer in CI and keep S3 Block Public Access on at the account level.

  • Static review of one policy; it can't see SCPs, permission boundaries, session policies or resource policies elsewhere
  • Doesn't evaluate a request the way the IAM engine does; use IAM Access Analyzer or the policy simulator to confirm
  • Suggested fixes (your account, used actions) depend on the inputs you pass

Rules

Rules last verified:

Informational; check the official source. Confirmed that non-public requires fixed values for principals or aws:SourceIp CIDR sets. The exact CIDR width AWS counts as public and the IAM element reference were not re-checked this round. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What it stops

Helps catch an S3 bucket made public by a policy

Also known as

aws iam · s3 bucket policy · iam policy · least privilege · principal · json policy · cloud security · devops

Field type

Dependencies

Pairs well with