Skip to content

Fix every launch failing at IAM setup on v0.129.0/v0.130.0 (#1069) - #1070

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/1069-spored-policy-account
Oct 17, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/1069-spored-policy-account

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #1069

Every spawn launch that sets up the spored role failed on v0.129.0 and v0.130.0 (MalformedPolicyDocument: The policy failed legacy parsing), before any instance was created. #905 put ${aws:PrincipalAccount} in the hybrid-registry grant's Resource. IAM's PutRolePolicy rejects that, while Access Analyzer and simulate-custom-policy both accept it. Reproduced on a throwaway role; details are in the issue.

Fix. The templates carry an explicit SPAWN-ACCOUNT-ID placeholder. bindPolicyAccount replaces it with the caller's 12-digit account ID (the account the role is created in) at all four writers: SetupSporedIAMRole, ensureSporedBaselinePolicy, createIAMRole and updateInlinePolicy. It refuses a non-12-digit account, and any document still carrying ${aws:PrincipalAccount}. The placeholder is deliberately neither 12 digits nor *: an unbound document is refused, not written with an account that matches nothing, or matches every account. The scope is unchanged: one table, in the role's own account.

Gate (TestEverySporedPolicyIsWrittenBoundToTheAccount). Runs every writer against Substrate (shared role, --iam-policy create, baseline, and the update path) and reads back with GetRolePolicy what actually reached IAM. Each binding site, reverted in a way that compiles, fails it and names the policy that reached IAM unbound, and so does the original bug (variable restored, binding removed). TestHybridRegistryGrantIsNarrow asserted the exact ${aws:PrincipalAccount} string, i.e. it certified the bug; it now asserts the bound ARN.

Limit of the gate: Substrate doesn't model IAM's grammar, so this proves no variable reaches IAM, not that IAM accepts the result. That the literal form is accepted was shown on real IAM (the throwaway-role probe in #1069). A real launch with this build is the next check.

Consumers: lagotto (v0.111.1), calque (v0.100.0) and spore-host-mcp (v0.126.1) all pin versions from before #905, so none is broken today. A Dependabot bump to v0.129.0 or v0.130.0 would break them, so this should ship as v0.130.1.

go vet, staticcheck (GOOS=linux), the hermetic suite, nested modules and semgrep all pass under GOTOOLCHAIN=go1.26.9.

@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.50000% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/aws/iam.go 62.50% 6 Missing and 6 partials ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn force-pushed the fix/1069-spored-policy-account branch from 1f783a1 to 7731f65 Compare October 17, 2026 01:54
@scttfrdmn
scttfrdmn merged commit 9b6d197 into main Oct 17, 2026
8 checks passed
@scttfrdmn
scttfrdmn deleted the fix/1069-spored-policy-account branch October 17, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Every spawn launch fails on v0.129.0/v0.130.0: spored role policy rejected (MalformedPolicyDocument)

1 participant