Repository navigation
fix(iamcoverage): count tag-on-create implied actions in the gate and inventory (#1377) - #1396
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
… inventory (#1377) internal/iamcoverage mapped each SDK call to one action, so CreateQueue with Tags was listed without sqs:TagQueue. Add an implied-actions table, each rule citing the Service Authorization Reference (and the service's page where it states the condition), and trace each call's input to decide whether the field may be set. Regenerate cli-iam-actions.md; grant sns:TagResource to the pipeline orchestrator, which tags its topic.
scttfrdmn
force-pushed
the
fix/1377-implied-tag-actions
branch
from
October 28, 2026 20:47
44bd26d to
136af70
Compare
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.
Fixes #1377
internal/iamcoveragemapped each SDK call to one IAM action, so a create call that tags what it creates was inventoried without the tag action AWS also authorizes (e.g.sqs:CreateQueue+Tags->sqs:TagQueue). Missing grants of that kind passed the coverage gate and then failed at runtime.What changed
internal/iamcoverage/implied.go: a table of implied actions keyed by operation + input field. Every rule cites the Service Authorization Reference's "API operations" entry for its operation, plus the service's own page where that page states the "only when tags are passed" condition.*<Op>Inputargument and works out whether the field may be set. It counts a non-nil composite-literal field, an assignment, a phi, a nested field (CreateBucketConfiguration.Tags), and the arguments at every call site of an enclosing function's parameter, using the call graph. Anything it can't see (a method value, a helper's return value, an escaping pointer) counts as set, so it over-approximates rather than missing a grant.docs/reference/cli-iam-actions.mdis regenerated, and its preamble no longer says tag permissions are left out.coverageErrors) so a fixture principal can be tested with it.Rules
Each rule below was checked against the SAR operations table (
servicereference.us-east-1.amazonaws.com/v1/<svc>/<svc>.jsonandlist_<svc>.html#…-operation-<Op>). Where the service's own page states the condition in prose, that page is cited too.Left out: scheduler:CreateSchedule (takes no tags, and the SAR lists no tag action for it), fsx:DeleteFileSystem final-backup tags (spawn sets none), and iam:PassRole implied by a role field (a different kind of rule; not modelled here).
Newly documented user permissions
These calls already happened; they are now listed:
Provisioned-principal grant (needs a live redeploy)
lambda/pipeline-orchestrator/template.yaml:sns:TagResourceadded to thespawn-pipeline-*SNS statement. The orchestrator creates its notification topic with aspawn:pipeline-idtag. The pipeline-orchestrator stack must be redeployed for this to take effect. Until then, per the SNS docs, a pipeline with a notification email can't create its topic (this is logged as a warning).No other Lambda or provisioned principal turned up a new gap, and no knownGaps entries were added.
Gates (each watched failing against a compiling revert)
TestImpliedActionsFollowTheCallSiteapplyImpliedshort-circuited. The tagged fixtures failed, includingqueueTagged: [sqs:CreateQueue], want [sqs:CreateQueue sqs:TagQueue].queueUntagged: [... sqs:TagQueue], want [sqs:CreateQueue].TestAnUngrantedImpliedActionFailsTheCoverageGateTestEveryImpliedRuleCitesItsSource: citations blanked, and it reported "no documentation cited".TestARuleForAMissingFieldIsReportedNotSkipped: field check disabled, and the bogus field silently applied.TestCLIActionInventoryIsCurrent: with revert 1 it reported the doc as stale.TestEveryPrincipalCallIsGranted: failed onpipeline-orchestrator calls sns:TagResourcebefore the template grant.make check,make lint(0 issues, all 10 modules) andsemgrep scan --config=auto --error .(0 findings) all pass.