Repository navigation
Scope spored instance permissions to the calling instance - #1606
Conversation
The spored roles may stop, terminate and tag only their own instance
(aws:ARN == ${ec2:SourceInstanceARN}), with explicit Denies retiring the
account-wide forms that older CLIs still write. spawn:config, spawn:iam-user
and spawn:nested-parent join the keys no instance may write. Spored grant
schema 2.
A --nested-spawn head's grants on existing instances (SSM, start/stop/
terminate, retag) now reach only the children it launched, which carry
spawn:nested-parent = its own aws:userid from RunInstances, and it may pass
only spored-instance-role and its own role.
A task role's results-bucket write is scoped to the results prefix.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Live check, spore-host-dev us-east-1, 2026-11-12. The CLI was built from #1607's head, which includes this PR.
Not yet run live: nested spawn (child scoping), the task results prefix, and Spot persistent cancel-then-terminate. |
The nested baseline exempted its tag Denies from tag-on-create with Null ec2:CreateAction, which does not hold for a direct CreateTags. Name the creates instead (StringNotLike RunInstances/ImportKeyPair/Create*Group), so spawn:nested-parent and the other instance-unwritable keys can be set only when a resource is created, never on an existing one, the head included.
|
Second live round (spore-host-dev, 2026-11-12). The CLI was built from #1609, which stacks on this PR.
|
New roles get the spore-host/spawn-instance-boundary at CreateRole; existing roles get it via PutRolePermissionsBoundary before any policy write. The boundary allows a broad data-plane ceiling and denies IAM administration, organizations/account actions and cross-account AssumeRole, so a role cannot be used to escalate IAM however its policies are written. Provisioned by 'spawn setup-account' (admin) or the first admin-run launch; the documented user baseline cannot create it, and a non-admin is told the command. 'spawn cleanup --instance-roles' deletes it once no role uses it. Align spawn onboard's portal policy with the live role and the BYOA template (#694): drop Stop/Start/Terminate, deny ownership-tag writes. Stacks on #1606.
|
Re-verified at |
New roles get the spore-host/spawn-instance-boundary at CreateRole; existing roles get it via PutRolePermissionsBoundary before any policy write. The boundary allows a broad data-plane ceiling and denies IAM administration, organizations/account actions and cross-account AssumeRole, so a role cannot be used to escalate IAM however its policies are written. Provisioned by 'spawn setup-account' (admin) or the first admin-run launch; the documented user baseline cannot create it, and a non-admin is told the command. 'spawn cleanup --instance-roles' deletes it once no role uses it. Align spawn onboard's portal policy with the live role and the BYOA template (#694): drop Stop/Start/Terminate, deny ownership-tag writes. Stacks on #1606.
…1609) * Cap every spawn-created IAM role with a permissions boundary New roles get the spore-host/spawn-instance-boundary at CreateRole; existing roles get it via PutRolePermissionsBoundary before any policy write. The boundary allows a broad data-plane ceiling and denies IAM administration, organizations/account actions and cross-account AssumeRole, so a role cannot be used to escalate IAM however its policies are written. Provisioned by 'spawn setup-account' (admin) or the first admin-run launch; the documented user baseline cannot create it, and a non-admin is told the command. 'spawn cleanup --instance-roles' deletes it once no role uses it. Align spawn onboard's portal policy with the live role and the BYOA template (#694): drop Stop/Start/Terminate, deny ownership-tag writes. Stacks on #1606. * e2e: record Tier 0 coverage decision for spawn setup-account
Summary
Narrows the instance-mutating grants on the spawn-created instance roles.
spored-instance-roleand everyspawn-instance-*role's spored baseline):ec2:CreateTags,ec2:DeleteTagsandec2:StopInstancesare allowed only whenaws:ARNequals${ec2:SourceInstanceARN}, the formTerminateOnlySelfhas used since Spot replacement self-retirement (#1008) STOPS the replacement instead of ending it: untagged, request cancelled, EBS bills forever #1080. Explicit Denies (DenyTagOthers,DenyStopTerminateOthers) retire the earlierspawn:managed-scoped grants, which CLIs up to v0.161.0 still rewrite on each launch.spawn:config,spawn:iam-userandspawn:nested-parentjoin the keys no instance may write.ec2:CancelSpotInstanceRequestsstays scoped tospawn:managed=true, because a Spot request's ARN is not the instance's. Spored grant schema 2.--nested-spawnrole: a child launched from a nested head is taggedspawn:nested-parent= the head'saws:userid, and the nestedRunInstancesrequires that tag. SSMSendCommand/StartSession, start, stop, terminate,GetPasswordData, Spot cancel and retagging of existing instances are conditioned on it.iam:PassRolecovers onlyspored-instance-roleand the nested role itself, not thespawn-instance-*family. The role name is a hash of the document, so heads launched by this CLI get a new role. The old one is reaped as before (pkg/instancerole) once unused. Security- and placement-group grants keep theirspawn:managed=truescope: those groups are found or created by name and shared with workstation launches.spawn task run): the results-bucket write is scoped to the results prefix (tasks/by default, or the spec'sresults_prefix), not the whole bucket. A per-task-id grant would give each task its own role, because roles are named by policy hash, and that would exceed IAM's role quota on fan-outs. See the comment ontaskiam.ResultsWriteTarget.The calls spored and the TTL reaper make were checked. spored stops, terminates and tags only
identity.InstanceID. The reaper, the dashboard and the orchestrators use their own roles.Account-wide grants that remain (no resource-level permissions in IAM)
ec2:DescribeTags,ec2:DescribeInstances(spored's own state and block devices, plus job-array peer discovery),ec2:DescribeVolumes(EBS cost footprint),ec2:DescribeSpotPriceHistory(Spot cost),ec2:DescribeAddresses(own launch EIP), andfsx:DescribeFileSystems/fsx:DescribeDataRepositoryAssociations(async FSx mount).Deploy checklist impact
spored-policy-v2,spored-baseline-policy-v2andspored-nested-baseline-policy-v2under/spore-host/. Older versions are detached and deleted as in v0.162.0: every default-role launch fails on accounts with other inline policies — spored-policy-v1 pushes spored-instance-role past IAM's 10,240-byte inline limit #1573.PutRolePolicyon a throwaway role for each changed document, and a live launch confirming that idle stop, TTL terminate, tag writes and self-terminate still work from an instance (details in the owner's notes).Tests
TestSporedRolesMutateOnlyTheirOwnInstance(an evaluator over both spored documents, alone and together with the legacy grants),TestSporedRolesCarryTheRetiringDenies,TestNestedSpawnRoleReachesOnlyItsOwnChildren,TestNestedSpawnPolicyNamesItsOwnRole,TestNestedHeadTagsItsChildren,TestTaskResultsWriteIsScopedToTheResultsPrefix, and the extendedTestStagedGrantKeepsTheRoleShared.go test -short -exec hermetic-exec ./...passes.make checkis clean except the three checks that fail locally only because the worktree path contains a space.