Skip to content

docs: document testing IAM permissions and a stack's service role (#411, #562) - #575

Merged
scttfrdmn merged 1 commit into
mainfrom
docs/562-iam-permissions
Aug 5, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
docs/562-iam-permissions

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

The docs half of v0.92.0. #570, #571 and #574 made IAM enforcement reachable and
correct; this makes it discoverable, and states the one rule that would otherwise
have readers writing tests that silently prove nothing.

docs/testing-guide.md — "Testing IAM Permissions"

Create a principal, attach a scoped policy, mint an access key, assert the denial —
with the denial and the allow side by side, since a test that only asserts the
denial passes for the wrong reason. It leads with the failure class rather than the
API, because that is why a reader would write such a test: a worker launched with an
instance profile granting no SQS permissions passes every mocked test and then never
drains a queue.

Existence in state is the opt-in gets its own subsection. Both halves are
stated, because each is a different way to be wrong:

  • a policy attached to a user that was never created denies nothing — there is
    no user to evaluate, so the test proves nothing while passing;
  • a principal that does exist with no policy is denied (an implicit deny,
    as on AWS) — which is the "forgot to attach the policy" case, not a pass.

Plus: STS session credentials evaluate against the role, a role named by a session
but absent from state is not enforced, and in-process emulator.Client callers never
sign a request so they carry no principal and are never authorized.

docs/services.md — CloudFormation

RoleARN on the three operations that take it and on DescribeStacks, in the
operation table and in a new "A stack's resource calls are authorized" section: the
per-operation lifetime rules (an update keeps the stored role; a delete's override
applies to that delete only and is not persisted, so a retry runs as the identity the
stack was created with), attribution to the creating principal absent a role, and a
worked example of the denial as it actually appears.

And the boundary, named rather than left to be discovered: the denial is not a
StackEvent. DescribeStackEvents is still refused with UnsupportedOperation,
DescribeStackResources' ResourceStatusReason is where a per-resource reason is
observable, and #501 is linked as where that changes.

Verification

make docs-reference-check (no plugin added or removed — the generated matrix is
untouched; all edits are in hand-written prose), make docs-versions
(scripts/check-doc-versions.sh — no pinned version in prose), and
npm --prefix docs run build. Every command shown was run live against
substrate server while verifying #574, so the outputs are transcripts rather than
constructions.

Part of #411 and #562; no Closes keyword — #411 is closed by #574, and #562
deliberately stays open for its StackEvent criterion (#501).

…, #562)

A "Testing IAM Permissions" section in the testing guide: create a principal,
attach a scoped policy, mint an access key, assert the denial. It leads with the
failure class this catches — a worker launched with an instance profile granting no
SQS permissions passes every mocked test and then never drains a queue — because
that is why a reader would write such a test at all.

The rule a reader will otherwise get wrong is stated on its own: existence in state
is the opt-in. A policy attached to a user that was never created denies nothing,
because there is no user to evaluate, while a principal that does exist with no
policy is denied. Both halves matter: the first is how a test silently proves
nothing, the second is the "forgot to attach the policy" case.

The CloudFormation reference gains RoleARN on the three operations that take it and
on DescribeStacks, the lifetime rules that differ per operation (an update keeps the
stored role, a delete's override is not persisted), how the calls are attributed
absent a role, and that a denied resource call is observable as CREATE_FAILED with
the denial as ResourceStatusReason — not as a StackEvent, with #501 named for why.
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit b89f7b5 into main Aug 5, 2026
16 checks passed
@scttfrdmn
scttfrdmn deleted the docs/562-iam-permissions branch August 9, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant