Repository navigation
Go parity (spawn v0.149.0): pinned signed bootstrap stub, pre-launch refusals, terminate-on-error - #111
Merged
Conversation
…9.0, plus launch refusals - userdata: the #1274 stub (fetch + sha256 + signature-verify the published bootstrap body), spored pinned to spawn/versions/0.149.0 (#1412), byte-equal to Go's BuildLinuxBootstrap for the same inputs (fixtures from v0.149.0); gzip+base64 like EncodeLinuxUserData; Go username validation. - refuse before any AWS call: user data over 16 KiB (#1063), a nested-spawn profile without a TTL (#1375), more than 50 tags (#1336). - terminate an instance whose launch failed after RunInstances unless keepOnError (#1298), in EC2Provider and SpawnClient. - launch durations use Go's pkg/ttl parser (1d; no signed values) and an unparseable one is refused instead of silently dropped (#990). - spawn:spot-request-type=one-time on Spot launches (#922). - plugins.json is Go json.Marshal byte-compatible (sorted keys, HTML escaping).
…ixture names, signed-duration reason
…e requests cannot stop; Go #922/#1330)
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 #108
Refs #109
Refs #110
Brings spawn-ts's launch path up to date with Go spawn v0.149.0. spawn-ts had not followed Go since v0.97.x, at the 0.7.0 release on 2026-08-01. Every item below cites its Go source. No AWS calls were made.
1. Bootstrap: Go's release-build stub, pinned to spawn v0.149.0 (#1274, #1412)
src/aws/userdata.tswas a hand-written copy of an August Go bootstrap, and it had drifted:spawn_fatal_retire.It now renders exactly what
launcher.BuildLinuxBootstraprenders in a Go v0.149.0 release build. That is the stub that:spawn/versions/0.149.0/bootstrap.shfrom the regional bucket, falling back to us-east-1;250f111b…54b2and its.sigverifies against the spore.host key;spawn/versions/0.149.0/, never latest.Any exit before spored is running terminates the instance.
src/aws/testdata/stub-fixtures.v0.149.0.jsonis Go's own output for five input sets: bare, key + custom user, command with quotes, custom completion file, and plugins with<>&. The tests require===.bootstrap-body.v0.149.0.shisspawn bootstrap-bodyat the tag, and a test pins the sha to it.scripts/gen-go-fixtures.sh 0.149.0takes the spawn module from the proxy (checked against the sum DB), renders the fixtures, and checks that the module's own CLI prints the same body. Re-running it changed nothing. The body hash can also be checked independently:go run github.com/spore-host/[email protected] bootstrap-body | sha256sum.EncodeLinuxUserDatadoes (CompressionStream). A bare launch is 1.8 KB.plugins.jsonnow matches Go'sjson.Marshalbytes (sorted keys, HTML escaping) via a newcore/gojson.ts. It is tested against Go-generated vectors.Why spored 0.149.0, and not a newer one (#108)
The pinned spored is not a Go release choice; it is the newest spored that enforces what spawn-ts writes.
active-ports,active-processes, both webhooks,notify-*andidle-cpuonly from the per-launch config object, and ignores those tags. There is no tag fallback, by owner decision.activePorts/activeProcesseswould stop holding an instance up, and an in-use instance could be stopped as idle.spawn/versions/0.149.0/is permanent. The release workflow publishes the body, spored,.sha256and.sigthere and reads them back before the CLI is installable (#1415).Moving past 0.149.0 means writing the object. That work is #110 and draft PR #112, stacked on this one, which depends on spawn v0.150.0. This PR can merge without it.
Behaviour changes callers can see:
EC2ProviderOptions.sporedSigningPublicKeyis now a rotation override. When absent, the spore.host key is used, so verification always happens, as in a Go release build.2. Refusals before any AWS call (Go
Client.Launch)CheckUserDataSize: 16384 decoded / 25600 encodedcheckUserDataSizeinEC2Provider.launch. Go'sTestCheckUserDataSizeLimitstable is ported verbatimCheckNestedSpawnTTL: aspawn-instance-nested-*profile needs a TTL; an idle timeout is not enoughcheckNestedSpawnTtl(core/bounds.ts). Go's table is ported, plus the ARN form, because spawn-ts accepts profile ARNs and Go is only ever given namescheckTagLimit: more than 50 tags is refusedcheckTagLimit. It runs once with Go's preflight stand-in identity (before STS) and again on the real set. Sweep params are still budgeted, never refused. A maximal spawn-ts launch is exactly 50 (tested)validateIdleCPU: a threshold outside 0-100buildLaunchTags, as Go'sbuildTagsrefuses it3. Lifetime
keepOnError/--keep-on-error. This is in bothEC2Provider.launchandSpawnClient.launch. In the client, a throwinglaunchedlistener or a failed follow-up list used to reject the launch while the instance kept billing. The error says whether the instance was terminated, kept, or could not be terminated.toSpecdidparseDuration(v) ?? 0, sottl: "1d","4 h"and"-1h"each became a launch with no TTL. Launch durations now go through a port ofpkg/ttl.ParseDuration/ParseTTL:dis accepted, and signed or unit-less values are refused, with Go's reasons.parse_test.gois ported verbatim.--ttl 0/--ttl=-1hare refused by the CLI. Tags are still read with the strictertime.ParseDurationgrammar.evaluateBounds); this PR does not change that.4. Tag contract
spawn:spot-request-type=one-timeon Spot launches (#922), read by Go's stop/status, the dashboard and the reaper.--taginput, so Go'sspawn:-prefix refusal (parseKVTags) has nothing to apply to. If one is added it must refusespawn:(case-insensitive).Intentionally left out
spawn:config(#1359)launchwould resolve minutes later); filed as #109--wait-for-sshInlineBody, Go dev builds)spawn:price-source, Go's%.6f/%.4fprice formattingGates (each watched FAIL against a revert that type-checks)
SPAWN_BOOTSTRAP_VERSION = "0.150.0"SPAWN_SPORED_VERSIONpin dropped (latest spored)FATAL_RETIREdroppedvalidateUsernamecall removedserializeDeclarationsback toJSON.stringifycheckUserDataSizecall voidedcheckTagLimitnever throwsparseDuration ?? 0/ CLI back toparseDuration/ signed check removedvalidateIdleCpucall removedcompletionFilenot passedspawn:spot-request-typeChecks
npm run typecheck,npm test(779 passed),npm run build,npm run build:lib,check:exports,check:imports: all pass.semgrep scan --config=auto --error: clean.release:checkfails only on "0.7.0 is already published", which is expected because no version bump is done here.