Skip to content

[DRAFT MVP] Hold deployment admission across state-init and runtime writer fencing - #207

Draft
mark-e-deyoung wants to merge 1 commit into
integration/mvp-owner-stateinit-fence-r1-20261123from
rdte/mvp-deployment-gate-r1-20261123
Draft

mark-e-deyoung wants to merge 1 commit into
integration/mvp-owner-stateinit-fence-r1-20261123from
rdte/mvp-deployment-gate-r1-20261123

Conversation

@mark-e-deyoung

Copy link
Copy Markdown
Collaborator

R040 independent deployment-controller workcell — real Compose wiring, fail closed

Problem

#205 composes source-exact #200 CAS and #201 cooperative state-init writer flock. However, a one-shot state-init releases the writer FD before the dependent runtime can acquire it. A competing Compose deployment could enter this interval.

Candidate solution

  • Second, controller-only /state/artifacts/sessions/.winebot-deployment-gate.lock on the SAME persistent artifacts external volume. deployment-gate is a tiny isolated long-lived OCI process; its health is asserted only AFTER a successful nonblocking exclusive Linux flock. No release/reacquire handoff for this deployment gate between state-init and runtime admission.
  • Both state-init and winebot-interactive require deployment-gate: service_healthy. A competing conforming full Compose project's controller cannot acquire its own lease until first project exits; the normal WineBot runtime writer lock still provides process-lifetime protection after a controller failure.
  • Deploy gate: network none, read-only root, cap-drop all and only DAC_OVERRIDE to reopen the root-protected control directory, no image push, 128MiB and 32 PIDs, 1MiB tmpfs for health marker. App bundle remains source-built digest pinned; no runtime installers, no privileged host changes.
  • Public synthetic replay script adds a real two-process same-volume gate-contender refusal, release/reacquire and persistent state replay. Real Wine11 HIL adds two separate Compose projects contending for the identical persistent volume with a health-gated initializer that must be rejected. Existing explicit no-deps state-init-vs-runtime refusal is retained.
  • formal/LAYERED_DEPLOYMENT_GATE.md records precise admission states, linearization points, fault cases, exclusions and mandatory gates.

Boundaries and acceptance

This is cooperative local Linux filesystem admission, not distributed consensus. A manually bypassed Compose graph, a malicious same-UID writer, namespace remapping, mismatched host mounts, root-host adversary and NFS are outside guarantee. CAP_DAC_OVERRIDE and a root-owned RW mount to external artifacts are explicit security review gates. Need exact-head free-public CI, synthetic negative controls, real Wine11 composite HIL and critic before considering admission. Active persistent-owner CAS pointer still not wired into restart, human STOP and WinInspect/native Windows acceptance remain blocked. DRAFT/DO NOT MERGE/NO RELEASE.

Parent #205 exact b520f5c419d1199ff536d5c6f8260dcadd2bc5ed. Initial candidate 702eb98ec07cc7b17c49ebc01ad2690b776b5a0e. Parent and owner branches remain untouched. No private GitHub Actions minutes, hardware/private artifacts, custom Wine patches, or protected-main mutations.

Copy link
Copy Markdown
Collaborator Author

R040 deployment-gate hard evidence — 2026-11-23

Exact first source 702eb98ec07cc7b17c49ebc01ad2690b776b5a0e: disposable layer source+replay #45175214300 terminal SUCCESS. This exercised actual offline app-bundle OCI build, lock-held gate1, independent gate2 lock_contended refusal on same external synthetic artifact volume, first and idempotent state-init replay, gate1 forced exit and gate reacquisition; no public raw host log or image push. TLC #45175214367 terminal SUCCESS (existing model set; does not formally prove new two-lock controller topology). Full CI #45175214275 and real Wine11 composite HIL #45175214365 still IN PROGRESS. Cross-Compose challenger rejection unqualified until HIL, and hostile same UID, NFS, gate crash/host root, wrong volume wiring, future pointer adoption remain explicit blockers. DRAFT, no merge.

Copy link
Copy Markdown
Collaborator Author

R040 adversarial security hold — SEV-1 if untrusted Wine workload shares UID with lock directory (2026-11-23)

Concrete custody flaw in the proposed two-lock architecture and inherited #184 writer file: scripts/layers/prepare-state.sh makes /state/artifacts/sessions UID1000-owned. Both .winebot-active-writer.lock and new .winebot-deployment-gate.lock live beneath it. Even if a root controller safely holds an open kernel flock to its original inode, a process sharing runtime UID1000 has write permission on the parent and can unlink/rename its directory entry and install another regular 0600 inode, then acquire a different exclusive flock. The startup identity checks do not prevent replacement after successful admission, and no periodic revalidation can make a concurrent mutation linearizable.
Synthetic reproducer completed in isolated temp directory: process 1 obtains LOCK_EX on old FD, same UID unlinks/recreates filename, process 2 obtains LOCK_EX on new FD. Result SYNTHETIC_REPLACED_LOCK=YES, BOTH_EXCLUSIVE_FLOCKS_GRANTED=YES, ACTUAL_WINEBOT_STATE_TOUCHED=NO. No actual user or project state used. Wine/guest app isolation has not been established, so this is a release STOP for potentially untrusted applications, not a harmless academic edge case. Separate controller + writer flock are sound only for explicitly cooperating process principals.
Corrective architecture required: move lock authority and persistent owner/generation into a dedicated protected control-plane volume/namespace/service that Wine apps and other UID1000 execution cannot unlink, rename, mount writable, or forge. Enforce guest/control process UID/user namespace separation and restricted volume mapping; mediate control via authenticated capability-scoped API/IPC with human STOP priority, not an unprotected same-UID socket. Record mount identity and lock inode custody, crash/replay + competing malicious same-UID negative cases; add independent critic/HIL before promotion. Avoid quick chmod/chown/ACL-only patch that leaves parent rename capability. Root controller CAP_DAC_OVERRIDE and exposed artifacts RW is also a separate privilege boundary to review.
CI: disposable controller gate #45175214300 PASS is a cooperative property only; real #207 HIL #45175214365 in progress, no claim of adversarial security. Keep PR DRAFT, do not merge or release.

Copy link
Copy Markdown
Collaborator Author

R040 full CI terminal + security distinction — 2026-11-23

Exact candidate 702eb98ec07cc7b17c49ebc01ad2690b776b5a0e: public full CI #45175214275 now TERMINAL SUCCESS, disposable dual-controller/replay #45175214300 TERMINAL SUCCESS, existing TLC #45175214367 SUCCESS. Full source-built Wine11 HIL #45175214365 still IN PROGRESS. All green controls currently assume cooperative well-behaved same-host actors, not malicious same-UID. The concrete lock-inode replacement risk remains a SEV-1 release STOP; newly durable draft #210 captures a separate-process synthetic negative reproducible in public CI. Do not interpret full CI green as security admission.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant