Repository navigation
docs(iam): the simulator's scope, and an e2e journey through it - #648
Merged
Merged
Conversation
docs/services.md carried the pre-release state: AttachUserPolicy and AttachRolePolicy "do not verify the policy ARN resolves", ListPolicies "lists CreatePolicy policies only", and GetPolicyVersion listed as not implemented. All three shipped in this milestone. The operation table now covers the eleven group operations, the two Simulate operations and the two version operations, and three new subsections state what the simulator does not evaluate and why each absence is honest rather than a gap: SCPs (a bound CheckAccess does not enforce either, so OrganizationsDecisionDetail is absent rather than false), statement positions (offsets into text substrate does not keep), and the cross-account details. test/e2e/journey_iam_simulate_test.go drives the milestone's point through the real SDK: one call, three actions, three different decisions, each traced to the policy that produced it — a group's managed allow, a user's inline explicit deny, and an ungranted action. Plus the boundary flipping an allow to an implicit deny, MissingContextValues on a conditional grant, and NoSuchEntity for an unknown principal asserted through the SDK's typed error. This level is the one that catches an unroutable operation (#636) and a .member.N list that never reaches a handler (#639); both are invisible to a unit test that calls the handler with a hand-built body.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The live CLI gate showed --path-prefix /service-role/ returning three, not the five service-role policies the prose claimed. AmazonSSMManagedInstanceCore and AmazonEC2ContainerRegistryReadOnly are service-role policies that AWS publishes at /, and the Path substrate reports is AWS's — what a policy is for and where it lives are different things.
…unds Two mutation-testing survivors, both in the #499 code. iamWarnUnresolvedPolicyARN returned whether the ARN resolved and no caller used it, so a mutant flipping every one of those returns passed the whole suite. A bool nothing reads is a value no test can observe; the log line is the entire observable effect, so the function now returns nothing and says why. The nil-logger guard moves to the top, where it also skips two state reads that could not have produced anything. The ARN length bound survived removal in both directions because the refusal tests asserted only the InvalidInput code, which the pattern arm produces too. The malformed-ARN table now asserts the message, and carries a case for each of arnType's own bounds — under 20 and over 2048 characters.
PluginConfig.Logger is optional, so iamWarnUnresolvedPolicyARN's guard is a reachable branch: nothing was asserting that an attach with no logger still records the attachment rather than failing on a diagnostic nobody is listening for.
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 documentation and end-to-end half of the v0.100.0 IAM work. No behaviour changes — every operation described here already merged.
docs/services.mdwas describing the pre-release stateThree entries were actively wrong after this milestone's PRs:
AttachUserPolicy/AttachRolePolicy: "Does not verify the policy ARN resolves (IAM: AttachRolePolicy/AttachUserPolicy accept a PolicyArn that GetPolicy cannot resolve #499)" — they now refuse a malformed ARN.ListPolicies: "ListsCreatePolicypolicies only;ScopeandPathPrefixare accepted and not applied (IAM: ListPolicies ignores Scope and PathPrefix and never lists bundled managed policies #497)" — it now applies them and sees the catalog.GetPolicyVersion, which substrate does not implement (IAM: GetPolicyVersion is unimplemented, so no policy document is observable over the wire #498)" — it is implemented.The operation table also omitted seventeen routed operations: the eleven group operations, both
Simulate*, both version operations, andDeleteInstanceProfile/RemoveRoleFromInstanceProfile/ListInstanceProfiles. All are now listed with the behaviour worth knowing before calling them.New prose
"What the policy simulator evaluates" — the three decisions and why the distinction matters to an assertion, exactly what is in the evaluated policy set for each of the two operations,
MatchedStatements/MissingContextValues, and the parameter defaults (including that there is no cap on actions per call)."What the simulator does not evaluate" — a table, one row per omission with its reason, because a fabricated field in a preflight answer is worse than a missing one: SCPs (stored by Organizations, never consulted by
CheckAccesseither, soOrganizationsDecisionDetailis absent rather than present-and-false),StartPosition/EndPosition(offsets into text substrate does not keep), the cross-account details, and the two ignored mode parameters. It closes by saying plainly that a consumer whose preflight depends on an SCP boundary cannot get that answer here."Finding a policy:
ListPoliciesscope" — thatScope=AWSmeans the 52-policy catalog, thatPathPrefixmust begin and end with a slash as IAM requires, thatOnlyAttachedis computed from stored attachments rather than the catalog's always-zero count, and thatPolicyUsageFilteris validated and narrows nothing (with the reason: guessing which side an unused policy falls on would silently drop all 52)."Attaching a policy substrate does not bundle", rewritten for #499's shipped behaviour, including the consequence a reader actually needs: an attached-but-unresolvable policy contributes no statements, so
CheckAccessand the simulator both behave as though it were not attached."Policy documents and versions" — the RFC 3986 encoding, and why one version per policy means
v1does not exist for a policy whose default isv2.test/e2e/journey_iam_simulate_test.goThe point of the milestone, through the real SDK. Four tests:
AmazonS3ReadOnlyAccess), a user's inline explicit deny, and an action nothing grants — oneSimulatePrincipalPolicycall, three actions, three differentEvalDecisionvalues, each traced throughMatchedStatementsto the policy that produced it. Checked together rather than separately, so a handler returning a uniform answer fails. ThenRemoveUserFromGroupand the allow becomes an implicit deny, proving the grant was only ever on the group.*NoSuchEntityException, which is what proves the wire shape rather than just the status code.SimulateCustomPolicyover documents that were never stored — the form a tool uses to check a policy it is about to write — includingResourceArnsdefaulting to*, and a boundary flipping an allow to an implicit deny withAllowedByPermissionsBoundary=false.MissingContextValueson a conditional grant, and the same simulation allowing once theContextEntryis supplied. Without this a conditional grant is indistinguishable from a missing one, and a preflight would report "you cannot" where the truth is "not with what you told me".This level is the one that matters for these operations: a unit test calls the handler directly and never learns whether it is routed (#636), and hand-marshals a body with real arrays while every parameter these two take is a query-protocol
.member.Nlist (#639). Both failure modes are invisible below this line.Verification
gofmt -l .clean;go build ./...;go vet ./...;golangci-lint run ./...→0 issues.;make test(race) green;make docs-reference-check docs-versionsclean;npm --prefix docs run buildclean;go vet -C test/e2e ./...and the fullgo test -C test/e2e ./...green.