Sealed Flow Manifest
Written for GOVW's own use and published openly: take what's useful, and tell us what's wrong.
Redirect loops, retry storms and runaway costs live in the paths nobody walks. This draft has a site write its flows as state diagrams, with a guard on every cycle and a cost on every step, then seal them so only its monitor can read them. The monitor walks the real production paths and reports what it covered, what looped, and what it cost.
1Terms
- Flow: a state diagram for one journey, such as sign-in, checkout or a booking.
- Guard: a condition that must hold for a step to happen, such as "fewer than 2 redirects in 60 s".
- Cost: what a step spends: money, messages, compute, or a scarce resource such as a booking slot.
- Monitor: the service that reads the manifest and walks the paths, for example 1x1.
2Writing flows
Each flow is a Mermaid state diagram kept in the site's repository at flows/*.mmd. Transitions carry an event, an optional guard and their costs:
stateDiagram-v2
[*] --> SignedOut
SignedOut --> Redirecting: visit [redirects < 2 per 60s] / cost=req:1
Redirecting --> Callback: idp_ok / cost=req:2
Callback --> SignedIn: token_ok / cost=req:1
Callback --> Stopped: token_bad / cost=req:0
SignedOut --> Stopped: visit [redirects >= 2 per 60s] / cost=req:0
Stopped --> SignedOut: try_again [user clicked] / cost=req:0
SignedIn --> [*]
Stopped --> [*]
The label grammar is event [guard] / cost=unit:amount, …, limit=…. Units are free-form but SHOULD be consistent across a site (for example usd, sms, req, cpu_s).
3Rules
- Every cycle MUST contain at least one guarded transition. An unguarded cycle is a loop waiting to happen.
- Every state MUST be able to reach an end state.
- Every transition that spends money or a scarce resource MUST declare its cost.
- A checker in the site's build SHOULD reject flows that break these rules, before anything is sealed.
4Sealing
At deploy, the site bundles its flows and encrypts them to the monitor's encryption key with JWE (RFC 7516) or HPKE (RFC 9180). The RECOMMENDED key is hybrid X25519 plus ML-KEM-768 (FIPS 203), so a recording made today stays sealed if large quantum computers arrive later. The site MUST verify the monitor's key with DNS Key Quorum before sealing. The monitor's encryption key MUST NOT be its signing key.
5Publishing
The sealed file is published at /.well-known/flows.jwe. It SHOULD be padded to a fixed size bucket, so its length doesn't reveal how many flows a site has.
6Walking real paths
A test sandbox is a different system, so the monitor walks the real production path. To keep that safe:
- The monitor signs its requests with HTTP Message Signatures (RFC 9421). The site uses the signature only to tag the records it creates, never to switch to a different code path.
- The site cleans up tagged records after the run.
- A sandbox is allowed only at third-party edges that can't be undone, such as a card payment. A site MAY also run a monthly live payment that is refunded.
- Every run has a budget. Cheap paths run every time; expensive ones run on a schedule.
7Planning a run
- Cycles: find every cycle and confirm each has a guard.
- Reachability: confirm every state can be reached and can reach an end.
- Cheapest paths: Dijkstra's algorithm, once per cost unit.
- Worst case: the most a single journey can spend once guards and limits are applied.
- Coverage: the cheapest walk that covers every transition (the Chinese Postman problem), cut to fit the run's budget.
8The report
After each run the monitor reports: paths covered and missed, loops found, real cost spent per unit, resources used, records left behind after cleanup, and any step whose observed cost exceeded its declared cost.
9Security considerations
- The manifest is a map of the site. That's why it is sealed, and why only the monitor's key can open it.
- Signed requests are not a pass. They tag records; they never skip checks, rate limits or payments.
- Key substitution: prevented by DNS Key Quorum; a site that can't reach quorum MUST NOT publish a new sealed file.
- Cleanup failure: tagged records left behind are counted in the report.
10Known gaps and questions
- A reference checker and a reference walker are needed.
- The guard grammar is free text today; a small formal grammar would make checks exact.
- How a monitor proves to the site that it deleted a manifest after use.
- The
/.well-known/flows.jwepath is not registered.
11References
- RFC 7516 JSON Web Encryption; RFC 9180 HPKE; FIPS 203 ML-KEM.
- RFC 9421 HTTP Message Signatures; RFC 8615 well-known URIs; RFC 9110 HTTP semantics.
- CWE-601 open redirect; CWE-835 infinite loop.
- Mermaid state diagrams.
- Related ALPQ drafts: DNS Key Quorum.