Repository navigation
Refuse cross-account trust into forbidden or management accounts on every path (#1582, #1583) - #1608
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…gement account everywhere spawn writes it (#1582, #1583) Move the forbidden-account list and the management-account rule into pkg/trustboundary, shared by the sweep role, spawn onboard and spawn notify register. The check fails closed: an Organizations error refuses, naming organizations:DescribeOrganization; only AWSOrganizationsNotInUse (proven: in no organization) passes. The sweep role also checks the orchestrator account's own organization with the infra credentials. The cross-account CloudFormation templates carry a Rules assertion refusing AWS::AccountId = 942542972736, and a CI test fails any cross-account template without one.
scttfrdmn
force-pushed
the
fix/trust-boundary-1582
branch
from
November 12, 2026 19:03
f59cfe0 to
9f50a1c
Compare
scttfrdmn
marked this pull request as ready for review
November 12, 2026 19:03
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 #1582. Fixes #1583.
Summary
pkg/trustboundarynow holds the forbidden-account list (942542972736) and the Organizations management-account rule. They moved out ofpkg/aws/sweep_role.go. The package takes lookups rather than importing the Organizations client, so the Lambdas that importpkg/awsdo not carry it.organizations:DescribeOrganization. The only lookup result that passes is the proven one:AWSOrganizationsNotInUseException(the account is in no organization), whichpkg/orgaccountalready reports as such.aws.CheckSweepRoleTrust).CheckSweepRoleAccountskeeps its signature and now fails closed.spawn onboardandspawn notify register(theSpawnBotCrossAccountrole) run the check before any IAM call. A principal ARN with no account is refused.TestCrossAccountTrustWritersCheckTheBoundarygates that the check precedes the trust write in each command.ttl-reaper-cross-account-role.yamlandbot-cross-account-role.yamlcarry aRulesassertion refusingAWS::AccountId= 942542972736. The reaper template also refuses that value forReaperAccountId.TestCrossAccountTemplatesRefuseTheForbiddenAccountdiscovers every template in the repository whose IAM role trusts an AWS principal and fails CI on any without the rule. It also fails if it discovers none. A template cannot ask Organizations, so the management-account half applies only to the CLI paths.The reaper does not create a cross-account role:
spawn reaper deploywrites a role trustinglambda.amazonaws.comin the caller's own account. So no reaper CLI path needed the check.Deploy checklist impact
Rules, which CloudFormation evaluates at stack create and update. Updating existing stacks is optional and changes no resource.organizations:DescribeOrganizationforspawn onboardandspawn notify register, and on the infra credentials for detached sweeps andspawn sweep setup. Every member-account principal may call it if its IAM allows.docs/reference/cli-iam-actions.mdis regenerated.Tests
pkg/trustboundaryunit tests,TestSweepRoleChecksTheOrchestratorsOrganization, the updated fail-closed cases inpkg/awsandcmd(TestSweepRoleRefusesAManagementAccount),TestOnboardRefusesForbiddenAndManagementAccounts,TestCrossAccountTrustWritersCheckTheBoundary, and the template gate with its self-test. Each was watched failing against a revert that compiles.cfn-lintis clean on both templates. The hermetic suite passes, except the space-in-path known failures.