a083cc80 Andy McCall 1 month ago ↶
1
# OxygenFlow (flow) — Deterministic Execution & Provenance Pipeline Specification
2
3
4
5
| ** Format version** | 1 |
6
| ** Date** | 2026-09-28 |
7
| ** Status** | Draft 0.1 |
8
| ** Target VCS** | Oxygen (oxy) Draft 0.8i |
9
| ** Audience** | Implementers, Security Architects, and Systems Engineers |
10
11
12
The key words MUST, MUST NOT, SHOULD, SHOULD NOT, and MAY are to be
13
interpreted as described in RFC 2119.
14
15
## 1. Overview and Core Invariants
16
17
OxygenFlow (flow) is a content-addressed, hermetic execution engine, runner system,
18
and pipeline language designed natively for the Oxygen (oxy) version control
19
system.
20
21
Existing runner engines (GitHub Actions, GitLab CI, Forgejo Runner) suffer from
22
structural flaws:
23
1. Workspace Bloat: Full clones, index unpacks, and checkout scans dominate I/O.
24
2. String Injection: Shell interpolation within untyped YAML files produces
25
expression injection and command execution exploits.
26
3. Decoupled Supply Chain: Attestations (SLSA, in-toto, Cosign) exist outside
27
the VCS, relying on external registries rather than native repository trust.
28
4. Coarse Caching: Opaque tarballs keyed by arbitrary string hashes fail to
29
leverage commutative history or granular dependency graphs.
30
31
OxygenFlow solves these liabilities through direct integration with Oxygen:
32
- Zero-Copy Workspaces: Jobs mount workspaces directly from Oxygen's FastCDC-
33
chunked, BLAKE3-addressed Content-Addressable Store (CAS) using Copy-on-Write
34
(COW) overlays.
35
- Commutative History & Impact Trees: Pipelines evaluate over change closures
36
rather than linear snapshot sequences. Commuting changes automatically reuse
37
cached execution receipts without redundant re-execution.
38
- Micro-Engine Sandboxing: Jobs run inside isolated environments (WASM, gVisor,
39
or MicroVMs) with strict, deny-by-default capabilities and no ambient
40
network egress.
41
- Native Cryptographic Provenance: Provenance and execution receipts are
42
generated outside the untrusted guest, encoded as deterministic CBOR, and
43
signed using composite Ed25519 + ML-DSA-65 keys as native Oxygen Attest
44
objects governed by in-repository Policy rules.
45
46
## 2. Threat Model and Security Architecture
47
48
### 2.1 Adversaries
49
- Untrusted Proposal Author: Submits code to an open repository containing
50
malicious build configurations intended to escape the runner, exfiltrate
51
secrets, or corrupt shared worker caches.
52
- Malicious Dependency / Upstream: Third-party dependencies invoked during
53
build time attempting out-of-band network calls or host file modification.
54
- Compromised Runner / Malicious Worker: An execution node attempting to
55
forge successful build receipts or inject backdoors into published artifacts.
56
57
### 2.2 Security Invariants
58
- I1 Deny-by-Default Execution: Sandboxes possess no network interfaces
59
(excluding loopback when requested) and no host filesystem access unless
60
explicitly granted in policy-signed configuration.
61
- I2 Injection-Free Invocation: Configuration parsing directly yields an argv
62
string vector executed via execve(). Shell interpretation (/bin/sh -c) does
63
not exist.
64
- I3 Host-Enforced Provenance: The running payload cannot author, inspect, or
65
alter its own provenance statement. Provenance is emitted solely by the
66
isolation hypervisor boundary.
67
- I4 Cryptographic Identity & Authorization: Runners execute using an Oxygen
68
Identity whose KeyId is enrolled as a delegate in the repository's Policy.
69
Unenrolled runners cannot publish recognized attestations or advance gates.
70
71
## 3. The OxygenFlow Configuration Language (.flow)
72
73
Pipelines are declared in KDL syntax within .flow/pipeline.kdl at the
74
repository root. KDL provides strict typing, structured nesting, and rejects
75
arbitrary text macro expansion.
76
b647ab72 Andy McCall 1 month ago ↶
77
Strings follow KDL 2.0, which has no ` \033` , ` \e` or ` \x` escapes: ESC,
78
for ANSI colours in a job's output, is ` \u{1b}` (` "\u{1b}[32mok\u{1b}[0m"` ),
79
and ` flow check` says so when it meets one of the others. Inside the
80
guest, ` /dev/fd` and ` /dev/stdin|stdout|stderr` link to ` /proc/self/fd`
81
as on any Linux system, so bash process substitution works.
82
a083cc80 Andy McCall 1 month ago ↶
83
### 3.1 Pipeline Specification Schema
84
85
``` kdl
86
schema-version 1
87
88
// Define the hermetic execution boundary
89
sandbox "rust-builder" {
90
runtime "microvm" // Options: "wasm" | "gvisor" | "microvm"
91
rootfs "cas://blob/9b5c2a1e8f3d4e7a6b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a"
92
memory-limit "4GiB"
93
cpu-limit 4
94
network "isolated" // Options: "isolated" | "loopback" | "egress"
95
}
96
97
// Job evaluated based on Oxygen change closure
98
job "compile-core" {
99
sandbox "rust-builder"
100
101
// Commutation boundary: runs only if change closure touches these paths
102
scope "crates/oxy-core/**" "crates/oxy-server/**" "Cargo.*"
103
104
// Zero-copy workspace mount backed by Oxygen CAS
105
mount {
106
source "oxy://workspace"
107
target "/src"
108
include "crates/oxy-core" "crates/oxy-server" "Cargo.toml" "Cargo.lock"
109
readonly #true
110
}
111
112
// Ephemeral scratch space
113
mount {
114
source "ephemeral://tmpfs"
115
target "/src/target"
116
size "8GiB"
117
}
118
119
env {
120
RUSTFLAGS "-Dwarnings"
121
CARGO_INCREMENTAL "0"
122
}
123
124
// Direct argv execution vector (no subshell)
125
exec "cargo" "build" "--release" "--package" "oxy-core"
126
127
output {
128
artifact "oxy-core-lib" {
129
path "/src/target/release/liboxy_core.rlib"
130
format "blob"
131
}
132
}
133
}
134
135
job "unit-tests" {
136
sandbox "rust-builder"
137
depends-on "compile-core"
138
139
mount {
140
source "oxy://workspace"
141
target "/src"
142
readonly #true
143
}
144
145
mount {
146
source "artifact://compile-core/oxy-core-lib"
147
target "/src/target/release/liboxy_core.rlib"
148
}
149
150
exec "cargo" "test" "--release" "--package" "oxy-core"
151
}
152
153
publish "release-provenance" {
154
depends-on "unit-tests"
155
156
attest {
157
kind "provenance"
158
bind-ref "bookmarks/main"
159
include-artifacts "compile-core/oxy-core-lib"
160
}
161
}
162
163
bf7bb1b8 Andy McCall 1 month ago ↶
164
**What starts a job.** An `on` block, at the top of the pipeline or in a job (the job's wins), names the events that run it: `push` with bookmark globs (none: any bookmark), `tag` with tag globs (none: any tag), `manual` ("Run pipeline", `oh run start`) and `schedule` with five-field cron lines on the hub's clock (UTC), run on the default bookmark. Without `on`, a job runs on every push and by hand, as before. A run has only the jobs its event starts (and what they depend on); an event that starts no job starts no run. A rerun repeats its run's event.
165
166
```kdl
167
on {
168
push "main" "feature/*"
169
manual
170
}
171
job "dist" {
172
on {
173
tag "v*"
174
manual
175
}
176
…
177
}
178
```
179
02b127d2 Andy McCall 1 month ago ↶
180
** Time limits.** A job may say how long it may run with ` timeout "90m"` (hours, minutes and seconds, as ` "2h"` , ` "1h30m"` or ` "45s"` , from a minute to a day); a sandbox's ` timeout` is the default for its jobs. Without one, the hub's default applies, and the hub caps every job at the site's maximum (both set by an administrator on Admin → Runners). The runner stops a job at its limit, and the hub ends one its runner stopped reporting a few minutes after it. A timeout is part of the compiled job, so a job without one compiles as before.
181
e87c1c13 Andy McCall 19 days ago ↶
182
** Priority.** A pipeline may lower its jobs' place in the hub's queue, never raise it (oxygenhub#244): ` priority "low"` (or ` "normal"` ) on a job, or at the top of the file for every job that does not say. A job's level is then the lower of its own and its repository's (the repository's, organisation's or site's, set on the hub), so nightly or bulk jobs can stand back for everyday ones; ` high` and ` urgent` are refused here, being the hub's to give, and a run a person expedites stays urgent whatever its jobs say. A priority is part of the compiled job; a job without one compiles as before.
183
e576e086 Andy McCall 1 month ago ↶
184
** Runner labels.** A sandbox or a job may say ` runs-on "LABEL" ...` : lower-case letters, digits, ` -` , ` _` and ` .` , at most 64 bytes each, given on one or more lines. A job needs a runner that has every label its sandbox and it name. A runner reports its labels and architecture when it registers and on each claim (` flow runner register --label` ). The hub hands a job only to a runner with all of them, within the runner's scope (OxygenHub spec 13.2), and a job no runner can take waits, saying so on the queue. Labels are part of the compiled job, so a job that asks for none compiles as before.
185
a083cc80 Andy McCall 1 month ago ↶
186
### 3.2 Canonical Compilation
187
Upon commit, .flow/pipeline.kdl is validated and compiled into a deterministic
188
CBOR job-graph blob. Runners evaluate the canonical CBOR to prevent syntax or
189
parser ambiguities across varying client platforms.
190
191
## 4. Sandbox Execution Engine
192
193
OxygenFlow implements three distinct isolation tiers depending on the workload:
194
195
### 4.1 Level 0: WASM Component Sandbox
196
- Intended for static linters, formatters, doc generators, and policy checks.
197
- Runs on a standard WebAssembly System Interface (WASI) runtime.
198
- Startup latency: < 5 ms.
199
- Zero host I/O; virtualized file system presented in-memory.
200
201
### 4.2 Level 1: Intercepted Syscall Isolation (gVisor / Landlock + seccomp-bpf)
202
- Intended for standard compilation and hermetic test suites.
203
- Emulates or filters Linux system call interfaces in user space.
204
- Blocks access to raw network sockets, real-time hardware clocks, and device
205
nodes.
206
- Memory and execution CPU quotas are strictly bounded via cgroups v2.
207
208
### 4.3 Level 2: MicroVM Isolation (Firecracker / Cloud-Hypervisor)
209
- Intended for kernel tests, multi-container integration, and untrusted code.
210
- Ephemeral Linux microVM booting in < 80 ms.
211
- The root filesystem is presented as a read-only virtio-block device mapped
212
directly to FastCDC chunks stored in Oxygen's CAS.
213
- Guest VM memory is cleared upon termination.
214
215
## 5. Content-Addressable Storage (CAS) & Zero-Copy Mounting
216
217
OxygenFlow runners bypass traditional clone operations. Repositories are accessed
218
directly via the local object store (.oxy/objects/) or streamed on demand
219
using Oxygen's wire protocol.
220
221
### 5.1 FUSE Overlay Mounting (flow-casfs)
222
1. The runner receives a task targeting an Oxygen State ObjectRef (a sorted
223
list of maximal heads).
224
2. The nearest Checkpoint is resolved. Uncommitted changes between the
225
checkpoint and heads are replayed into a virtual tree in-memory.
226
3. The virtual tree is exposed to the sandbox via flow-casfs:
227
- File reads resolve chunks using the FastCDC gear table (32 KiB to 256 KiB,
228
mean 64 KiB) pinned in Oxygen Spec Section 13.2.
229
- Missing chunks are fetched lazily using the POST /objects protocol.
230
- To prevent FUSE context-switch bottlenecks on many small reads, flow-casfs aggressively mmaps chunk data and utilizes host page caching.
231
- All guest mutations are diverted to a scratch tmpfs layer; base objects
232
remain immutable.
233
234
### 5.2 Artifact Capture
235
1. At task completion, flow-casfs scans the paths declared in the output block.
236
2. Modified outputs are chunked with FastCDC, hashed via BLAKE3-256, and
237
written as canonical Blob and Chunk objects.
238
3. Output ObjectRefs are stored directly in the Oxygen repository.
239
240
## 6. Commutative Execution & Change Caching
241
242
In Oxygen, changes that do not share scopes (referenced atoms, placements, or
243
nodes) commute. OxygenFlow exploits this invariant to provide granular caching.
244
245
### 6.1 Execution Receipt Object
246
Every successful or failed job run emits an immutable Receipt:
247
248
``` cbor
249
Receipt {
250
version [0]: 1
251
job_name [1]: text
252
pipeline_hash [2]: ObjectRef
253
scope_tree_hash [3]: ObjectRef // BLAKE3 tree hash of the materialized scope
254
inputs [4]: [ObjectRef] // Artifacts and input files consumed
255
environment [5]: ObjectRef // Hash of rootfs, compiler flags, and argv
256
outputs [6]: [ObjectRef] // Produced artifact blobs
257
exit_code [7]: u32
258
duration_ms [8]: u64
259
}
260
```
261
262
A Receipt is hashed as an Oxygen object with type name "receipt":
263
ObjectRef = BLAKE3-256("oxy1 receipt " || decimal(len) || 0x00 || body)
264
265
### 6.2 Cache Re-use Invariant
266
Let Scope(J) be the file paths and tree nodes declared by job J.
267
Because changes that do not share scopes commute, we do not need to track lists of ChangeHashes. Instead, we hash the materialized tree of Scope(J).
268
269
If an existing Receipt R exists such that:
270
R.job_name == J.name & &
271
R.pipeline_hash == Hash(J) & &
272
R.scope_tree_hash == TreeHash(Scope(J)) & &
273
R.environment == CurrentEnvironmentHash
274
275
Then the job execution is bypassed. R.outputs are mapped into downstream
276
dependents immediately as a cached-commuted hit.
277
278
## 7. Native Provenance Specification
279
280
OxygenFlow formalizes build provenance as a native, tamper-evident Oxygen Attest
281
object (kind: "attest"). Provenance is generated exclusively by the runner
282
hypervisor, not the guest payload.
283
284
### 7.1 Provenance Object Schema
285
286
``` json
287
Attest {
288
version [0]: 1
289
kind [1]: "attest"
290
repo [2]: bytes(16) // Oxygen Repository ID
291
hlc [3]: HLC // Hybrid Logical Clock
292
body [4]: {
293
"type": "flow/provenance/v1",
294
295
// Subject artifacts produced by the build
296
"subjects": [
297
{
298
"name": text,
299
"ref": ObjectRef, // BLAKE3 hash of output blob
300
"media_type": text
301
}
302
],
303
304
// Builder platform and execution identity
305
"builder": {
306
"runner_id": KeyId, // ObjectRef of runner's Oxygen Identity
307
"isolation_level": text, // "wasm" | "gvisor" | "microvm"
308
"hypervisor_image": ObjectRef // Rootfs blob digest
309
},
310
311
// Exact input materials
312
"materials": {
313
"state_heads": [ChangeHash], // Oxygen heads of the state built
314
"scope_tree_hash": ObjectRef, // Captures exact state without O(N) array bloat
315
"inputs": [
316
{
317
"name": text,
318
"ref": ObjectRef // Content hash of locked dependencies
319
}
320
]
321
},
322
323
// Structured execution arguments
324
"invocation": {
325
"job": text,
326
"pipeline_spec": ObjectRef, // ObjectRef of .flow/pipeline.kdl
327
"argv": [text], // Unmodified execution vector
328
"env": map<text, text> // Explicitly whitelisted environment
329
},
330
331
// Environment observations
332
"metadata": {
333
"started_on": u64, // Wallclock milliseconds
334
"finished_on": u64,
335
"hermetic": bool, // Verified zero outbound network access
336
"reproducible": bool
337
}
338
}
339
}
340
```
341
342
### 7.2 Composite Signatures
343
All provenance attestations are signed using Oxygen's composite signature
344
construction (Ed25519 and ML-DSA-65):
345
346
``` cbor
347
Signature {
348
key [0]: KeyId
349
alg [1]: 1 // 1 = Ed25519 + ML-DSA-65
350
ed [2]: bytes(64) // Classical signature
351
ml [3]: bytes(3309) // Post-quantum signature
352
}
353
```
354
355
Both signatures are computed over:
356
"oxy1 sig attest\0" || KeyId || ObjectRef
357
358
## 8. Policy Integration & Bookmark Gates
359
360
Oxygen repositories enforce branch and bookmark protections via signed Policy
361
objects (Oxygen Spec Section 14.5). OxygenFlow integrates provenance directly into
362
policy evaluation during push validation.
363
364
### 8.1 Policy Gate Definition
365
A Policy rule governing a bookmark MAY demand valid OxygenFlow attestations. To mitigate a compromised authorized worker, high-security repositories can require ** Consensus Builds** by setting the threshold > 1. This requires multiple independent runner identities to arrive at the exact same output hashes and both sign it.
366
367
``` json
368
PolicyRule {
369
pattern: "bookmarks/production"
370
keys: [ KeyId ]
371
threshold: 1
372
require: "signed"
373
allow_conflicts: false
374
require_attestations: [
375
{
376
type: "flow/provenance/v1",
377
job: "release-provenance",
378
require_hermetic: true,
379
signer_roles: [ "official-worker" ]
380
}
381
]
382
}
383
384
### 8.2 Push Verification Sequence (VCS Engine Enforcement)
385
When a push request arrives at an Oxygen server attempting to update a
386
protected bookmark:
387
1. Object Integrity: Validate that all changes, chunks, and blobs exist and match
388
their BLAKE3 hashes.
389
2. Attestation Resolution: Verify that an Attest object of type
390
"flow/provenance/v1" is present, referencing the exact heads of the new
391
State.
392
3. Identity Verification: Validate that the attestation's composite signature
393
resolves to a KeyId listed as an authorized delegate of the repository
394
policy roots.
395
4. Invariant Checking: Confirm that the provenance statement records
396
"hermetic: true" and exit code 0.
397
5. Atomic Update: If validation fails at any point, the entire push is refused
398
with ok = false.
399
400
## 9. Zero-Environment Secret Brokering
401
402
OxygenFlow forbids the injection of raw secret strings into process environment
403
tables to eliminate accidental leaking via child process dumping, procfs
404
reads, and verbose compiler logging.
405
406
### 9.1 Ephemeral Secret Broker
407
1. If a job requires a credential (e.g., signing key, cloud deployment token),
408
it declares a secret mount:
409
secret "deploy-token" {
410
vault-ref "infra/tokens/prod"
411
mount-path "/run/secrets/token"
412
}
413
2. The runner negotiates a short-lived token lease from the configured vault.
414
3. The secret is mounted onto an ephemeral, in-memory ramfs location inside
415
the sandbox with access mode 0400, owned exclusively by the worker process.
416
4. Upon process termination, the memory pages are zeroized and the token is
417
marked for immediate revocation at the vault.
418
419
## 10. Conformance and Verification Requirements
420
421
A conforming OxygenFlow implementation MUST pass the following tests:
422
423
1. Injection Immunity: Attempting to supply unescaped shell metacharacters
424
(; && | ` $() \n) in any job field MUST pass those characters as literal
425
bytes to argv; subshells MUST NOT be spawned.
426
2. FastCDC Determinism: Chunks produced by artifact extraction MUST match
427
the gear table cuts and BLAKE3 hashes generated by Oxygen's core chunker.
428
3. Commutation Hit Invariance: For any two commuting changes A and B, running
429
a pipeline on State(A, B) MUST reuse cached receipts generated on State(A)
430
for any job whose scope does not intersect the touched paths of B.
431
4. Non-Downgrade Attestation: An attestation missing the ML-DSA-65 component
432
MUST be rejected by policy verification.
433
5. Hermetic Network Isolation: Jobs configured with network "isolated" MUST
434
have outgoing TCP SYN and UDP packets dropped at the hypervisor boundary.