Repository navigation
docs: document testing IAM permissions and a stack's service role (#411, #562) - #575
Merged
Merged
Conversation
…, #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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
no user to evaluate, so the test proves nothing while passing;
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.Clientcallers neversign a request so they carry no principal and are never authorized.
docs/services.md— CloudFormationRoleARNon the three operations that take it and onDescribeStacks, in theoperation 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.DescribeStackEventsis still refused withUnsupportedOperation,DescribeStackResources'ResourceStatusReasonis where a per-resource reason isobservable, and #501 is linked as where that changes.
Verification
make docs-reference-check(no plugin added or removed — the generated matrix isuntouched; all edits are in hand-written prose),
make docs-versions(
scripts/check-doc-versions.sh— no pinned version in prose), andnpm --prefix docs run build. Every command shown was run live againstsubstrate serverwhile verifying #574, so the outputs are transcripts rather thanconstructions.
Part of #411 and #562; no
Closeskeyword — #411 is closed by #574, and #562deliberately stays open for its
StackEventcriterion (#501).