Commit graph

25 commits

Author SHA1 Message Date
0xkite
56e3cbd638
fix(linux): support delegated systemd subgroup
Keep gloved in a systemd-owned supervisor leaf while creating sibling session cgroups under the empty delegated parent. Under mapped-root supervisors, attach blocked children before releasing their existing start gate instead of combining nested UID mapping with CLONE_INTO_CGROUP.
2026-09-01 15:33:03 -06:00
0xkite
6e47c25fdc
fix(container): admit inherited socket probes
Permit Node/libuv read-only type inspection only on committed child
descriptors while offline socket and connect remain denied.

Recheck queued input after audit and around response release. Late
pipelined frames now poison the channel instead of crossing the gate.
2026-09-01 11:38:09 -06:00
0xkite
5c48e5fd8a
fix(control): report start replay disposition, hard-cap jsonl audit journal, deterministic control tests
MEDIUM 1: session_runtime::start() now returns an explicit
fresh-launch vs replay disposition (session_start_result), and
handle_start_session sets outcome.applied only for a fresh committed
launch. An authenticated idempotent start replay therefore never gains
connection-scoped teardown authority: a broken pipe during a replay can
no longer stop an already-running guest. The control audit event for a
replayed delivery carries the replay disposition
(start_session:replay:<session>).

MEDIUM 2: jsonl_sink truncation now accounts for record delimiters
exactly, so current_bytes_ always tracks the physical file; only
newline-terminated complete records are retained (no blank or partial
lines, bounded read window); the cap is a hard cap (an oversized event
is dropped with a structured operator note; a pre-existing oversized
journal is bounded with a bounded read at construction).

MEDIUM 3: the broken-pipe degrade test now synchronizes through a
mutex-protected condition-variable gate handshake that proves the
dispatch is parked inside the blocked gate before the client resets,
records the start only after the dispatch completes, and the
mark_stopping test destroys every registry lock holder (runtime,
protocol, registry) before the independent registry reopen so the
nonblocking exclusive flock can actually be acquired.
2026-08-31 09:34:45 -06:00
trvon
a8137db76b
feat(control): neutral guest channels, quarantine recovery, capability sealing, local-service proxy
Introduce the framed guest_channel_transport with shared deadlines and
std::jthread ownership, metadata-only retired-schema quarantine with
fail-closed integrity, stateless frozen-catalog validators with
capability pinned to zero, and the generic local-service proxy with
descriptor-pinned endpoints, alias-only guest sockets, audit-gated
delivery, and a Linux managed runtime capability derived only from a
registry-bound operational factory. Sage vocabulary is confined to
src/adapters/sage.
2026-08-30 20:28:41 -06:00
0xkite
09d34002a6
Merge PR #25 (guest channel layer) into PR #24 (wallet stack + Apple repairs)
Combine maintainer/wallet-status-and-apple-repairs (18e75af8) with
maintainer/guest-channel-layer (00d7c473) into a single validated
integration branch for Ghost deployment testing.

Merge resolution decisions:

- Apple container runtime (the known conflict zone) auto-merged
  textually and was verified semantically against both parents:
  the maintainer hard-disable survives (lifecycle_operational()
  returns false unconditionally, apple_container_session_runtime.hpp),
  the sampler/finalizer jthread lifecycle seam and the finalizer
  catch-all well-formed terminal state (a96ab1e) are intact, and
  null_terminated=false strict_json_options is preserved. Velinus's
  observation-intent integration lands adapted on the repaired base:
  prepare_observation_service is only reachable from start(), which
  denies before side effects when the lifecycle is disabled, so the
  observation service never constructs on the disabled Apple path.
  The gated test from PR #25 (every control method refuses before
  side effect; record counts unchanged) survives.
- GLOVE_GUEST_OBSERVATION_* env names kept; observation socket/token
  volumes still mount only when observation_service->active().
- guest_channel layer, host-registered schema admission
  (channel_descriptor/channel_host), SO_PEERCRED/LOCAL_PEERCRED, LRU
  replay cache, bounded retry, fail-closed recovery, and
  channel_identifier_grammar.hpp land as-is; session_registry files
  did not conflict with PR #24's side.
- Wallet status files: PR #25's delta did not touch them, so the
  harness-neutral renames (wallet_status_projection_channel) stand
  unchanged.

Validation (umask 0022): dev/asan/tsan presets build clean and
CTest 80/80 each (control_apple_container_session_runtime
env-gated/skipped as expected); clang-format (llvm@22) applied to
changed sources; git diff --check clean. No push.
2026-08-29 16:23:23 -06:00
0xkite
4a487dafdb
feat(control): generalize the guest specialized-channel layer
Generalizes the PR #23 guest observation plumbing into a schema-agnostic
specialized-channel layer while keeping all harness policy out of core.

Generalized admission (F2/HIGH):
- New channel_descriptor/channel_host interface (include/glove/control/
  guest_channel.hpp): hosts register {channel_id, schema_id,
  body_validator, bounds{max_items, max_body_bytes, max_ttl_ms,
  max_skew_ms}, on_exchange} at registry construction; core keeps only
  structural invariants (identifier charset, digest hex, TTL/skew
  arithmetic, capacity, idempotency) and delegates body semantics to
  registered validators.
- The closed two-schema check in session_registry internals is removed:
  glove_observation_schema, glove_sxxx_proposal_* constants and the
  fixed SXXX digest move out of session_registry_impl.hpp. The Sage
  schemas are now registered by the harness adapter
  (apple_detail::sage_guest_channel_host) and gloved_main wires the host
  into the registry; schema strings appear only in harness-adapter and
  test-fixture registration examples.
- enqueue_observation_intent binds intents to the session's PARSED
  runtime_id; the hardcoded sage_guest_runtime equality checks are
  removed from session_registry.cpp, session_registry_recovery.cpp and
  valid_record_shape. Replay of a now-unregistered schema fails closed
  (open_or_create rejects stores carrying unadmitted intents), and
  enqueue without an admission table is rejected. The observation
  socket server takes runtime_id from configuration instead of
  hardcoding "sage-guest". The observation body hash domain becomes the
  harness-neutral "glove.observation-body.v1" (pre-merge delta; no
  on-disk compatibility is preserved).

Recovery fix (F1/HIGH):
- same_session_snapshot now neutralizes state, running_at_ms and
  policy_revision before comparing frozen intent/disposition snapshots
  against the bound session record, so lifecycle progression and policy
  revision advances never read as a binding crossing; every other
  frozen-field difference still does. Exposed for tests. Regression
  tests cover running->stopping and stopping->exited transitions plus a
  late post-exit disposition end to end (destroy/reopen), and a
  snapshot-identity unit test pins the neutralization (and proves
  non-neutralized fields still cross). Note: an empirical probe showed
  the previously-claimed failure does not reproduce under ordered
  journal replay because intent/disposition records freeze the session
  record they were appended from; the neutralization is applied as the
  defensive fix the memo requires and is now pinned by tests.

Hardening:
- F3: peer-uid verification (SO_PEERCRED / LOCAL_PEERCRED) on observation
  socket accepts, configurable expected uid, rejecting unexpected peers
  before any frame is read.
- F4: the replay cache is a bounded LRU (configurable capacity), so the
  old fixed 1024 cap can no longer permanently kill the channel; the
  durable registry remains the authoritative idempotency layer.
- F5: transient wait/accept errors (EINTR/EAGAIN/ECONNABORTED/EMFILE/
  ENFILE/ENOBUFS/ENOMEM) are retried inside serve_one_for with a bounded
  backoff ladder; only persistent or fatal errors surface. The Apple
  worker loop absorbs persistent failures up to a consecutive-failure
  bound and emits an audit event (new audit action "observation") on
  repeated failures instead of dying on the first hiccup.
- F6: env/mount names generalized to GLOVE_GUEST_OBSERVATION_SOCKET /
  GLOVE_GUEST_OBSERVATION_TOKEN_FILE and the in-container token path to
  /home/agent/.glove-observation-token (Apple runtime, docs).

Apple boundary: the soft lifecycle_operational() definition is unchanged;
the lifecycle-disabled lane now additionally asserts start_session/
stop_session deny with method_not_found and leave the registry untouched
(denial before side effects; the observation service only constructs
inside a lifecycle-gated start).

Docs: architecture.md and session-policy.md describe the guest
specialized-channel admission model and the peer-uid/env naming.

Validation (umask 0022):
- cmake --preset dev/asan/tsan + build + ctest: 100% (76/76) in each
  configuration; asan/tsan are warnings-as-errors builds.
- git diff --check clean; changed files clang-formatted with Homebrew
  llvm@22 against the repo .clang-format.
- No fuzz target exists for the queue/registry (fuzz/ covers plans,
  bundles, manifests, MCP codec, jsonpath only), so no fuzz corpus run.
- control_remote_validation_executor is a pre-existing load-sensitive
  sleep-race test; it flakes identically on the unmodified pr23-head
  baseline under CPU load (verified 1/6 both trees) and always passes
  isolated.

Files: 23 changed (+~1500/-~360), including new guest_channel.{hpp,cpp}.

Signed-off-by: 0xkite <me@hack4kites.dev>
2026-08-29 16:04:27 -06:00
0xkite
7f9b703a90
feat(control): add private Pi wallet status adapter and argument-order repair
Pi-facing wallet status adapter: private, disabled by default,
status-only projection with strict redaction — no wallet secrets,
no mutation actions, no capability advertisement, unregistered on
the MCP surface. Includes the wallet_pi_status_adapter unit suite
and the argument-order repair for the managed-session invocation.

Layer 5 (final) of the reviewed Glove wallet-status stack.

Validation: dev CTest, ASan/UBSan, TSan, and libFuzzer 10,000 units
per target on this exact stacked tree (see workflow184 layer
records).
2026-08-29 09:48:17 -06:00
0xkite
95617c966b
feat(control): add wallet status managed session owner
Wallet status managed session: exact current session/plan/policy
revalidation, owned trusted-clock zero/rollback/deadline/freshness
checks, and bounded 64-KiB SIGPIPE-safe Unix-socket framing over
the inherited channel. Fail-closed on missing readiness or malformed
observation. No wallet secrets or mutation authority.

Layer 4 of the reviewed Glove wallet-status stack; includes the
wallet_status_managed_session unit suite.

Validation: dev CTest, ASan/UBSan, TSan, and libFuzzer 10,000 units
on the final stacked tree (see workflow184 layer records).
2026-08-29 09:48:03 -06:00
0xkite
e55889afa7
feat(control): add Glove wallet status bridge core
Wallet status bridge: strict typed JSON wire, bounded channel, and
no-mutation status surface. Includes the wallet_status_json fuzzer
with a seed corpus (duplicate method keys, escaped duplicates,
malformed surrogates, nested duplicates, out-of-range requests,
unknown fields, and valid request/response shapes) and the
wallet_status_bridge unit suite.

Layer 3 of the reviewed Glove wallet-status stack; status-only,
disabled by default, and no capability advertisement.

Validation: dev CTest, ASan/UBSan, TSan, and libFuzzer 10,000 units
on the final stacked tree (see workflow184 layer records).
2026-08-29 09:47:49 -06:00
0xkite
6971f61f00
Merge current PR #23 head 4097a21 with validated Apple repairs
Merge PR #23 head 4097a21adb (Velinus's
"Make Apple resource sampling lifecycle safe") into the Layer-2
integration branch, preserving all contributor commits unchanged.

Retained proven fixes from 4097a21:
- Sampler creation moves into start_finalizer() so a sampler
  std::system_error is reported synchronously to the caller. In
  ca8600a the sampler was constructed inside finalize() after the
  caller had treated startup as successful; the failure path
  published an error without attach reaping, container deletion, or
  durable mark_managed_failed, and set finished_ so stop() became a
  no-op while attach/container survived.

Repairs retained beyond the contributor head, each bound to a
demonstrated failure:
- std::jthread + deterministic stop_token handles the partial-start
  case where sampler construction succeeds but finalizer launch
  fails (regression: tests/control/apple_container_unavailable_test
  and the start_sampler_then_finalizer seam used by production).
- Restored hard-disabled Apple boundary: lifecycle_operational()
  false, receipt schema 0, disk enforcement unavailable, empty
  managed runtime advertisement, and public method denial before
  any side effect. The current PR #23 head crossed the reviewed
  activation boundary (schema 0 -> 1, filesystem_quota advertised,
  lifecycle constructed-state true) without live-validation.
- glaze parsing hardened: strict_json_options now sets
  null_terminated=false; non-NUL-terminated string_views fed
  parse_apple_container_stats and duplicate_key_guard caused a
  heap-buffer-overflow read in glz::skip_ws (ASan crash input
  [{"id":"aanumProcesses" reproduced deterministically; seed corpus
  fuzz/corpus/apple_container_stats/truncated-object.json added).
- Sage bundle projection admission hardening (Layer-1 2bba117) and
  its test coverage carried through the merge.

Validation (umask 0022):
- Dev CTest 76/76; ASan/UBSan 76/76; TSan 76/76.
- libFuzzer 10,000 units each: library_bundle, session_plan,
  apple_container_stats (LLVM 22, ASan/UBSan), all fuzz_exit=0.
- clang-format clean on changed TUs; git diff --check clean.
2026-08-29 09:41:16 -06:00
velinussage
4385e1b5ee Add per-session guest observation socket 2026-08-29 01:04:55 -04:00
0xkite
d2884cdef9
test: add managed client adoption matrix 2026-08-23 09:18:59 -06:00
0xkite
127fe80052
test(glove): register workerd supply-chain test in CTest
Register tests/scripts/test_fetch_workerd.py (30 network-free checks of the pinned workerd tool) as the workerd_supply_chain CTest entry, so the supply-chain verification runs in the normal ctest suite.
2026-08-13 07:01:38 -06:00
trvon
afecee2c90
feat(remote): add construction-only backend
Co-authored-by: trvon <git@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-08-07 22:27:35 -04:00
trvon
22e7c2de50
fix(onboarding): harden setup plan
Derive runtime templates before setup validation so reruns preserve existing policy. Redact policy JSON by default to avoid exposing owner-local details.
2026-08-03 09:19:50 -04:00
trvon
c3a6c1b7d1
feat(adoption): harden Pi harness sessions
Bind Glove-owned Pi adoption snapshots to launch profiles and receipts while keeping host state out of private homes. Add an offline hostile-content policy and repeatable Linux service setup.
2026-08-02 18:10:55 -04:00
trvon
2ab53bcc35
feat(refinement): define evidence protocol 2026-07-31 14:08:28 -04:00
0xkite
497e703e70
feat(runtime): manage sandboxed agent sessions
Keep credentials and network access behind authenticated, audited brokers while binding launch adapters, immutable closures, recovery identities, receipts, and cleanup to the approved plan. Add Apple Container and Linux release lanes without weakening the outer sandbox.
2026-07-30 08:49:42 -04:00
0xkite
bf53ba4a48
feat(host): guide managed harness setup
Detect and bind operator-installed harnesses through explicit, digest-bound runtime policy. Keep macOS and Linux shipping lanes capability-aware and fail closed when isolation evidence is absent.
2026-07-29 16:15:04 -04:00
0xkite
d09032b30e
feat(supervisor): enforce native harness sessions
Bind runtime homes, mounts, and receipts to verified adapter context.\nReject malformed launch encodings before execution.
2026-07-28 11:00:17 -04:00
0xkite
8fecc3f142
fix(mcp): reject mismatched JSON-RPC IDs 2026-07-21 22:23:19 -04:00
0xkite
8f50e47816
feat(host): manage the gloved user service 2026-07-20 16:50:26 -04:00
0xkite
11d603a1cf
Add host setup and project enrollment workflow 2026-07-20 10:30:29 -04:00
0xkite
0fe581b028
Add bounded path exposure and retained apply controls 2026-07-20 08:59:38 -04:00
0xkite
0dafbed1e8
Initial Glove sandbox baseline 2026-07-19 21:06:11 -04:00