Repository navigation
sec(iam): cap every spawn-created role with a permissions boundary - #1609
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
Author
|
Live verification (spore-host-dev, 2026-11-12):
Account state: the dev account now carries the boundary. Released CLIs keep working there; the boundary only caps what they create. |
scttfrdmn
force-pushed
the
fix/sec-role-permissions-boundary
branch
from
November 12, 2026 07:46
4ab1ba9 to
0abc5c5
Compare
Contributor
Author
|
Rebased onto #1606 |
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.
scttfrdmn
marked this pull request as ready for review
November 12, 2026 18:44
scttfrdmn
force-pushed
the
fix/sec-role-permissions-boundary
branch
from
November 12, 2026 18:45
0abc5c5 to
91ec9a0
Compare
Merged
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.
Summary
Caps every IAM role spawn creates with a customer-managed permissions
boundary, so that whatever is written onto an instance role — including a
caller's own
--iam-policy-fileor--iam-managed-policies— the role cannotbe used to administer IAM or reach another account.
Stacks on #1606 (
fix/sec-instance-roles, the spored self-scoping +sporedPolicySchema2). This PR's base ismainso CI runs and it carries#1606's commit; merge #1606 first and review the last commit.
The boundary
arn:aws:iam::<account>:policy/spore-host/spawn-instance-boundary.Allow *ceiling, then explicitDenyof IAMadministration (create/modify users, roles, groups, policies, access keys,
assume-role trust, permissions boundaries),
organizations:*,account:*,and
sts:AssumeRoleinto another account(
aws:ResourceAccount != ${aws:PrincipalAccount}).iam:PassRoleandiam:CreateServiceLinkedRoleare not denied (the nested and sweep rolesneed them). A
*boundary is no containment; an enumerated one breaks broad--iam-policy-fileworkloads, so this denies only the escalation surface.data-plane access they do not hold themselves; IAM cannot express
"role ⊆ caller". An account that needs tighter narrows the boundary's
resources or launches with
--instance-profile.CreatePolicyVersion+SetAsDefault, pruning theoldest non-default version to stay under IAM's five-version cap); the name is
fixed because the documented baseline names it literally.
Provisioning and roles
CreateRole; existing roles getPutRolePermissionsBoundarybefore any policy write, so a role is neverleft with weaker containment mid-launch.
spawn setup-account(new, admin) provisions it; the first admin-run launch also creates it. A
non-admin whose account has no boundary gets an error naming
spawn setup-account.spawn cleanup --instance-rolesdeletes the boundary once no role uses it.#1607's app rolespawn-instance-appis in thespawn-instance-*family and is created throughthe same
createOrGetInstanceProfilepath, so this change covers itautomatically when #1607 merges. No rebase onto #1607 is needed; nothing
extra is required for the app role.
Onboard (#694)
spawn onboard's portal role dropsec2:StopInstances/StartInstances/TerminateInstances/CancelSpotInstanceRequests, matching the live portal roleand the BYOA template, and adds an ownership-tag
Deny.What an existing account's admin must run once
with credentials allowed to create IAM policies. Re-running upgrades the
boundary when the document changes and is otherwise a no-op.
Until an admin runs it: launches that must create or update an instance
role are refused, with an error naming the command. An admin's own first launch
provisions the boundary as a side effect.
Not yet verified against AWS
No AWS calls were made. Before merging, prove the boundary document with a real
PutRolePolicy/CreatePolicy, runsimulate-custom-policyfor the allow/denycases under the baseline, and confirm a live launch still brings spored up under
the boundary.
Tests
pkg/aws/iam_boundary_test.go: new account, existing-boundary, non-admin(names the command), retrofit, create/no-op, schema bump, five-version cap, a
golden for the boundary document (valid JSON, no policy variable in a
Resource, condition keys belong to their action's service), and the full
createOrGetInstanceProfilepipeline against the IAM emulator.pkg/instancerole: the boundary deleter (in use → kept; unused+old →deleted, versions first; young → kept).
cmd:spawn setup-accounthermetic test; onboard and sweep gates updated.make checkclean except the three checks that fail locally only because theworktree path contains a space; the hermetic suite passes;
semgrep scan --config=auto --erroron the changed paths is clean.GOTOOLCHAIN=go1.27.4.Refs #694.