Repository navigation
fix(security): scope spored CreateTags to managed instances (#174) - #236
Merged
Merged
Conversation
#174) The spored IAM role granted ec2:CreateTags on Resource "*" with no condition, lumped in with the read-only Describe* calls — while TerminateInstances/ StopInstances were conditioned on ec2:ResourceTag/spawn:managed=true. A compromised spore could therefore tag ANY instance spawn:managed=true and then terminate it, so the condition on the destructive actions provided no real containment (the forgeable spawn:iam-user owner tag likewise). Fix: split CreateTags/DeleteTags into their own statement conditioned on ec2:ResourceTag/spawn:managed=true, so a spore can only (re)tag instances ALREADY in scope — it cannot pull a foreign instance into scope. spored only ever tags its own instance (which carries spawn:managed=true from launch), so legitimate use is unaffected. Also adds the previously-missing DeleteTags grant the FSx-mount path uses. updateInlinePolicy re-applies this to existing roles on the next launch/refresh. Regression test asserts CreateTags carries the spawn:managed condition. Closes #174.
…licy Splitting tag-writes into their own conditioned statement (#174) made the base spored policy 3 statements (read / tag-write / destructive) instead of 2; update the count assertions accordingly.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Closes #174 (HIGH, from the 2026-06 suite audit).
Problem
The spored IAM role granted
ec2:CreateTagsonResource: "*"with no condition (lumped in with the read-onlyDescribe*calls atpkg/aws/iam.go), while the destructiveTerminateInstances/StopInstanceswere conditioned onec2:ResourceTag/spawn:managed=true. So a compromised spore could tag any instancespawn:managed=trueand then terminate it — the condition scoping the destructive perms gave no containment.Fix
Split tag writes into their own statement conditioned on
ec2:ResourceTag/spawn:managed=true:A spore can now only (re)tag instances already in scope — it can't bring a foreign instance into scope to then terminate it. spored only ever tags its own instance, which carries
spawn:managed=truefrom launch, so legitimate use is unaffected. (Also adds the previously-missingDeleteTagsgrant the FSx-mount path uses.)updateInlinePolicyre-applies this to existing roles on the next launch/role refresh.Tests
TestSporedTagPermissionsScopedasserts the CreateTags statement carries thespawn:managed=truecondition (and that some statement still grants CreateTags, so spored's lifecycle tagging keeps working).make checkclean.Note
The companion HIGH #173 (dns-updater Route53 spoofing) is a separate, cross-repo IAM-auth change — documented on that issue, shipping independently. This PR is self-contained.