Repository navigation
Sign workflow run mail with the run principal's key - #258
Merged
alexanderguy merged 14 commits intoNov 5, 2026
Merged
alexanderguy merged 14 commits into
alexanderguy merged 14 commits into
Conversation
A principal whose private key lives outside the hub still needs its public key on record, so the hub can verify what the principal signs. Such a row has no private key, and the hub refuses to sign with it.
The anchor lock already serializes first commits, so the principal link the commit writes onto the run row can mark it. A run principal's existence then says nothing about whether the run has committed, and the principal can be created independently of the first trigger.
A stopped or failed deployment deactivates each run's own principal, found by its run reference rather than by the run row's link, so a run principal that its run has not linked yet is deactivated too.
A run principal that exists from deploy gives the run one identity for its whole deployment, ready to hold a key the party running it supplies. Because the principal exists before the first trigger, an operator can act on it then: the first trigger keeps grants given to it, honors a deny among them, and refuses to start a suspended or deactivated one. The invoker grants a first trigger derives still last a day from the principal's creation, which is now the deploy, not the first trigger.
Every deploy frame carries an allocation, so the listener that wrote the key for an ack with no allocation could no longer fire. It is gone rather than kept as a second key writer that takes no allocation lock.
Recording a key whose private half lives elsewhere needs no cipher, and the callers that record a sidecar's key hold a transaction but no key store. Module functions that take the caller's transaction let them record and retire keys under the caller's own lock.
The sidecar running a deployment holds the private half of its key, so the run principal that answers for the deployment holds the public half as a public-only key. The deploy ack records it there and on the anchor, and existing keys are copied over, so the two copies agree. A replacement sidecar can report a new key, so the replaced one is retired. The ack's key must be 32 bytes of lowercase hex, the form the copy checks, so a malformed key is refused at the wire.
A replaced sidecar's key is retired on its run principal, so reading the active key there stops a retired key from verifying mail.
Only an allocated deploy attempt's completion or failure settles a run sender's parked mail. A deploy in flight without one has nothing that settles it, so mail parked on it could only expire undelivered.
A run principal holds its deployment's only signing key, and its run names it by reference rather than by a foreign key, so the existing referenced-principal refusal did not cover it.
Member
Author
Self-Review (
|
alexanderguy
marked this pull request as ready for review
November 5, 2026 20:21
alexanderguy
deleted the
intr-709-sign-workflow-run-mail-with-the-run-principals-key
branch
November 5, 2026 20:43
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
principal_keyrow. The sidecar keeps the private key, and the hub stores only the public key and refuses to sign with it.workflow_run.public_keyno longer exists. Migrations 0119 to 0122 makeprincipal_key.private_keynullable, give existing deployments run principals, copy each deployment's key to its run principal, and drop the column. Each migration refuses data it cannot carry over faithfully.allowrows last 24 hours from deploy, not from the first trigger, so a first trigger more than a day after deploy gets none, including an existing deployment that has not fired. A run principal whose run exists cannot be deleted (409). A run sender's mail parks only while its allocated deploy attempt is open. The deploy ack's key must be 32 bytes of lowercase hex. Hubs that run the previous version must stop before the migrations run.Verification
make allpasses: lint, type check, the admin UI bundle, and the unit (10319), workflow-deploy (255), and core (1569) test passes.Closes INTR-709