Repository navigation
Conversation
…n Mark (#1672) spawn doctor's "idle teardown" check tried an UpdateItem on its own, so an identity granted dynamodb:UpdateItem but not dynamodb:ConditionCheckItem passed while every mark it made was refused. Probe now makes the mark's transaction (a ConditionCheck and an Update) with conditions that never hold: a cancellation proves both item actions are authorized and nothing is written. iamcoverage: the sweep orchestrator's member-account context claims libs/lifecycle, so a lease mark added to the orchestrator is demanded of SpawnSweepCrossAccountRole, never of SpawnSweepOrchestratorRole in the infra account. The nested-spawn coverage discovery now sees lifecyclemark.Mark and records the lease actions as deliberately not granted to spawn-instance-nested-* roles, with the reason. Also removes an orphaned fragment from [Unreleased] ### Changed. Refs #1672
…n's (#1672) A region with no spore-host-lifecycle table passed the idle-teardown check on DescribeTable alone, which any read-only DynamoDB identity holds. The check now probes the us-east-1 table (the global scope's, which spawn setup-account creates) before saying the first launch creates it. Refs #1672
…4, GO-2026-6975) Both were published 2026-11-23, after main's last green Security run, and turn this PR's Go Vulnerability Check red with no related change. Root module plus the dashboard-api, dns-updater, sweep-orchestrator and ttl-reaper Lambdas; every nested module re-tidied. Refs #1672
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…1672 review) otlptrace, otlptracehttp and stdouttrace move to v1.47.0 in the root module and the dashboard-api and dns-updater Lambdas (dns-updater was on v1.44.0), so every OTel module is on one release. Their v1.47.0 needs newer genproto, grpc-gateway, mapstructure and proto/otlp; every nested module re-tidied. Refs #1672
…tside the aws partition (#1672 review) - doctor no longer says "the first launch creates it". In a region with no lease table the first mark needs dynamodb:CreateTable and TagResource, which nothing can check without creating the table (no dry run; a CreateTable IAM allows creates it), and the check says so. It still probes the mark's writes on the us-east-1 table; with no table there either it is "not checked", pointing at spawn setup-account. - Outside the aws partition doctor no longer probes us-east-1 or points a refusal at the aws-only user policy. Mark no longer marks the global scope there: the mark was refused, and a refusal stopped every later mark in the process, so a launch's regional mark never ran. - Probe passes only when every cancellation reason is ConditionalCheckFailed or None; anything else is ErrInconclusive ("not checked"). - iamcoverage: a write transaction's item actions come from implied rules on TransactItems.<kind>, so doctor's probe needs ConditionCheckItem and UpdateItem only (cli-iam-actions.md regenerated); MarkActive, whose condition check comes from a helper, still counts all four. - The orchestrator's member-account context also claims pkg/lifecyclemark. - Comment fixes: UserActions' probe uses three actions; the nested-spawn reason cites spawn#1672 instead of itself. Refs #1672
This branch has not been deployed
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.
Refs #1672 (does not close it; see "The four roles"). Part of the leave-no-trace epic, spore-host/spore-host#752.
What changes
spawn doctorchecks the write a mark actually makesThe "idle teardown" check (
lifecyclemark.Probe) used to try anUpdateItemon its own. A mark is oneTransactWriteItems: aConditionCheck(that the closing sentinel is absent) plus anUpdate. DynamoDB authorizes each item action. So an identity grantedUpdateItembut notConditionCheckItempassed doctor, while every mark it made was refused. Both actions came backimplicitDenyin #1672's dev simulation.Probenow makes that transaction: aConditionCheckand anUpdateon two probe keys. Their conditions can never hold.TransactionCanceledExceptionproves both actions are allowed.spore-host/spawn-user-lifecycle.In a region with no lease table yet, the check used to pass on
DescribeTablealone, and any read-only DynamoDB identity holds that (AWSReadOnlyAccess, for one). It also implied that the first mark there would succeed, though that mark needsdynamodb:CreateTableanddynamodb:TagResource, which it never checked. Now:us-east-1table, which holds the global scope and whichspawn setup-accountcreates.spawn setup-account.The seam is
probeLease, tested with per-region fakes inpkg/doctor/lease_probe_test.go.Why CreateTable/TagResource aren't probed:
CreateTableonly proves something if DynamoDB authorizes before it validates. That isn't documented, and it can't be confirmed without an AWS call. If validation came first, the probe would pass anyone; if the input validated, it would create the table.iam:SimulatePrincipalPolicyisn't something doctor has. Most users can't call it, and it doesn't evaluate session policies or SCPs.Outside the aws partition (GovCloud, China, ISO, EUSC; region per the SDK's aws-partition regex):
us-east-1, which those credentials can't reach. The resultingUnrecognizedClientExceptioncounts as a refusal, and a refusal stops every later mark in the process, so a launch whose IAM setup marked global first never marked its own region.lifecyclemark.GlobalReachable) and marks regions as before.spore-host/spawn-user-lifecycle, whose ARNs are aws-partition ones (pkg/aws/iam_account_setup.gohard-codesarn:aws).Probepasses only when every cancellation reason isConditionalCheckFailedorNone, with at least one of the former. Any other reason (a throttle, a conflict) isErrInconclusive, and doctor reports it as "not checked", not as a pass or a refusal.docs/reference/cli-iam-actions.mdis regenerated. The generator now derives a write transaction's item actions from the items the call site builds: implied rules onTransactItems.{ConditionCheck,Put,Update,Delete}, and all four when an item is built out of sight. Sospawn doctorlistsConditionCheckItem,DescribeTableandUpdateItem, which is what its probe needs.MarkActivetakes its condition check from a helper (sentinelAbsent), so it still counts all four, andRequiredActions,UserActions()and the user policy are unchanged.What doctor reports:
spore-host-lifecycle is writable in <region>.; spawn's global scope (its table is in us-east-1) is not marked outside the aws partition.the mark's writes are allowed (checked on the us-east-1 table); no spore-host-lifecycle table in <region> yet, and the dynamodb:CreateTable and dynamodb:TagResource its first mark needs cannot be checked without creating it.not used in spore.host's infra account.idle teardown not checked: …):us-east-1(or inus-east-1itself), withrun spawn setup-account, which creates the us-east-1 table, then spawn doctor again;the us-east-1 table is not checked outside the aws partition);… cancelled for ThrottlingError, None; try again).idle teardown unavailable: the spore-host-lifecycle lease table isn't writable by <caller ARN> (the mark's transaction (dynamodb:ConditionCheckItem, dynamodb:UpdateItem): …not authorized to perform: dynamodb:ConditionCheckItem…). Launches are unaffected, … An administrator attaches the policy spore-host/spawn-user-lifecycle (arn:aws:iam::<acct>:policy/…)….…The policy spawn setup-account provisions (spore-host/spawn-user-lifecycle) names aws-partition ARNs, so it does not grant this here; spawn's marks here need … on the spore-host-lifecycle table.The IAM coverage gates now see who runs a mark
internal/iamcoverage/principals_test.go). Its member-account context now claimslibs/lifecycleandpkg/lifecyclemarkcall sites (leasePkgs). Before this, a mark added to the orchestrator would have been checked againstSpawnSweepOrchestratorRolein infra 966362334030. That account has no lease, and the gate would have countedUpdateItem/PutItemas granted because it matches on name, and that role holds them on another table. With the claim, a mark is demanded ofSpawnSweepCrossAccountRole.pkg/aws/nested_spawn_discovery_test.go). The source-following discovery couldn't see Mark's DynamoDB calls, because they live in libs, outside the module. Reachinglifecyclemark.Marknow addslifecyclemark.RequiredActions. The nested role holds none of them on the lease table, so each is recorded innestedSpawnNotGrantedwith the reason (below).Dependency bump, so CI can pass
go.opentelemetry.io/otel,otel/sdkandotel/tracego from v1.46.0 to v1.47.0, for GO-2026-6974 and GO-2026-6975:dashboard-api,dns-updater,sweep-orchestratorandttl-reaperLambdas, with every nested module re-tidied.dashboard-api, anddns-updater(which was on v1.44.0). Their v1.47.0 pulls newer genproto, grpc-gateway, mapstructure and proto/otlp. Only these three modules use the exporters.CHANGELOG
### Fixed(doctor's check, and Mark outside the aws partition) and### Security(the OTel bump) entries under[Unreleased].[Unreleased] ### Changed("baseline cannot re-create it. … A spored managed"), a leftover of feat(setup-account): --remove/--offboard, and provision the user lifecycle-lease policy (#1656, #1666) #1669. The full text is in[0.168.0].The four roles in #1672: no grant added, because none of them makes a mark
I traced the code each role runs. Granting the lease to any of them would be a grant nothing uses, and it would not make a regional scope go ACTIVE:
SpawnSweepCrossAccountRolecmd/launch_sweep.go:1407), and the reaper counts unfinished sweep and schedule records as activity (lambda/ttl-reaper/accountidle.go). I checked it two ways. Nolifecyclemarkimport, and the coverage gate passes on main with noConditionCheckItemgranted to either orchestrator role. Also,TestSweepCrossAccountRoleGrantsOnlyWhatTheOrchestratorCallsfails on an uncalled grant. The role's source ispkg/aws/sweep_role.go; the setup script is gone since #1537.spore-portal-launchiam-policy-source.test.ts("is read-only: only Describe and quota reads") fails on any write.spore-portal-e2elive.test.tsdrift check enforces that. The e2e test instances are launched byspore-portal-e2e-teardownthrough spawn-ts.GitHubActions-spawn-ts-live-smokescripts/live-smoke.mjs(spawn-tsEC2Provider)infra/iam/github-oidc/trusts.jsonsays it isn't codified, so there's no source to edit.So the dev regions show
lease unavailable … skippedbecause nothing that marks has created there since v0.168.0. The launches there go through spawn-ts (smoke, portal e2e) or through orchestrator sweeps. The real gap is in spawn-ts, filed as spore-host/spawn-ts#143. Once spawn-ts marks, the roles it runs as (andspore-portal-launchwhen #686 brings launches back) need the seven actions.Other principals that run spawn's Go create path in member accounts
spawn-instance-nested-*(--nested-spawnhead nodes, e.g. nf-spawn). A child'sspawn launchcalls Mark with the nested role, which holds no lease grant, so the mark is refused silently. Not granted here, as a deliberate default for the owner to confirm.spawn:managedinstance, so its region and the global scope stay active, and the teardown can't claim them while it runs.NestedSpawnLeasestatement innestedSpawnStatementsand deleting the sevennestedSpawnNotGrantedentries. The role name, a hash of its document, changes with it.secrets.AWS_DEV_ROLE_ARN(dev). It runs the latest spawn release'sspawn launch, so it reaches Mark today when dispatched (the nightly run is currently skipped). It isn't codified anywhere; filed as Dev integration role behind spore-plugins AWS_DEV_ROLE_ARN runs spawn launches but has no codified lifecycle-lease grant spore-host#759. The fix there is the one case where attaching the managed policyspore-host/spawn-user-lifecyclebeats an inline statement: a hand-made role has no source to carry one.lagotto-capacity-poller-rolealready grants all seven, ontable/spore-host-lifecycle, through its own lease (pkg/runtimeiam).spawnCLI as a user-supplied identity.spore-host/spawn-user-lifecyclecovers them, and doctor's check run on the host names the gap.lambda/rest-apipins spawn v0.36.1, so it makes no mark yet. Noted in feat(spored): copy a failed job's log tail to the serial console (#736) #759 for when it is bumped.ttl-reaper(its member role already grants the lease, inttl-reaper-cross-account-role.yaml), pipeline-orchestrator (infra, where Mark is skipped), dashboard Lambdas, andspawn snapshot mounton an instance (it attaches to itself, so its live instance keeps the region active).Also found: detached
spawn resumere-invokes the orchestrator without marking the sweep's regions. Filed as #1675.The action set
spawn pins libs v0.55.0. There,
MarkActiveisDescribeTableandCreateTable(withTags, soTagResource), oneTransactWriteItems(ConditionCheckplusUpdate), andDeleteItemfor a stale sentinel.lifecyclemark.RequiredActions(7) matches that, andTestLeaseRequiredActionsAreWhatMarkCallsholds it to the call graph. libs v0.56.0'sMarkActivemakes the same calls; its new conditional writes are other entry points. Nothing is missing, and nothing was widened.Nothing here touches 966362334030, adds anything that could reach 942542972736, or tags
spore-host:role=service.Tests and checks
TestProbemodels IAM per item action. Each ofUpdateItemandConditionCheckItemrefused must be the probe's refusal, and the same model must refuseMarkActivetoo, so the model is what the mark needs. Revert check: with the oldProbe(it compiles),TestProbefails withdynamodb:ConditionCheckItem refused: <nil>, want that refusal.TestProbeLease(doctor) covers 11 cases. Each checks what the result must say, what it must not say (no "first launch creates it", no policy pointer outside aws), and that nothing was written. A probe of a region the case doesn't expect fails it, which is how the GovCloud cases proveus-east-1is never touched. Revert checks (each compiles):inAWS := true || …fails the three GovCloud/China cases;TestProbeAcceptsOnlyItsOwnCancellationcovers 7 sets of reason codes. With the code check disabled (false && !ok), the four non-condition sets fail.TestMarkSkipsTheGlobalScopeOutsideTheAWSPartitionuses a GovCloud config, with aus-east-1table that refuses the credentials the way the real endpoint does. WithGlobalReachableforced true it fails twice:Mark called the us-east-1 table 1 timesandno table was touched for us-gov-west-1. That second failure is the latch bug itself.TestGlobalReachablecovers 13 regions across the partitions.TestImpliedActionsFollowTheCallSitehas four new fixture transactions:ConditionCheckItem,UpdateItem;PutItem;DeleteItem.TestDiscoversEveryShapeOfCallincludes them too.lifecyclemark.Mark(ctx, cfg, region)on the orchestrator's member config (not committed):TestEveryPrincipalCallIsGranteddemands all seven ofSpawnSweepCrossAccountRole;SpawnSweepOrchestratorRole, the wrong role in the wrong account, and missesUpdateItem/PutItem.if false && …, which compiles), the test fails on all six newnestedSpawnNotGrantedentries as stale. With it enabled and no entries, it fails namingConditionCheckItem,CreateTable,DescribeTableandTagResource.make checkpasses:check-build-tagstoo, run from/private/tmp. Run from the/tmpsymlink it reports a false "compiled by no single-tag run", a path artifact.go testpasses for the root package,internal/iamcoverage,pkg/aws,pkg/doctorandpkg/lifecyclemark.semgrep scan --config=auto --erroris clean on the changed files.No AWS calls were made.