Add Remote session foundations and feasibility checks
Add opt-in Tentacle protocol 1.1, explicit remote grants, lifecycle IPC and expiring core leases in both SDKs. Revoke access before update preparation, including failed updates. Add transient secret entries, shared Braille cell export and isolated Xorg recovery experiments with focused tests and documented limitations. Production consent, desktop services and live interoperability remain pending.
This commit is contained in:
1 parent
a47253d697
commit
573d15d7b4
45 files changed
+3634
-80
No files matched your search
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// Authors: Storm Dragon, Angus Kola
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package xorg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// This records a prerequisite, not an injection-origin solution: the current
|
||||
// XRecord observer receives XTEST traffic through the ordinary input path.
|
||||
// Remote must add trusted provenance before these events can reach consent or
|
||||
// forwarding decisions. Run only through tests/native_remote_input.py.
|
||||
func TestNativeRemoteInjectedKeyObservation(t *testing.T) {
|
||||
if os.Getenv("CTHULHU_NATIVE_REMOTE_INPUT") != "1" {
|
||||
t.Skip("requires private Remote input harness")
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
listener := New()
|
||||
if err := listener.Start(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer func() {
|
||||
stopCtx, stopCancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer stopCancel()
|
||||
if err := listener.Stop(stopCtx); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}()
|
||||
key := func(name string) {
|
||||
t.Helper()
|
||||
if out, err := exec.CommandContext(ctx, "xdotool", "key", name).CombinedOutput(); err != nil {
|
||||
t.Fatalf("private key injection: %v %s", err, out)
|
||||
}
|
||||
}
|
||||
// XRecord starts asynchronously. Wait for an observed marker instead of
|
||||
// assuming a sleep is sufficient for server-side readiness.
|
||||
tick := time.NewTicker(20 * time.Millisecond)
|
||||
defer tick.Stop()
|
||||
ready:
|
||||
for {
|
||||
select {
|
||||
case <-tick.C:
|
||||
key("F12")
|
||||
case event := <-listener.Events():
|
||||
if event.Name == "F12" && !event.Pressed {
|
||||
break ready
|
||||
}
|
||||
case <-ctx.Done():
|
||||
t.Fatal("XRecord did not observe readiness marker")
|
||||
}
|
||||
}
|
||||
key("a")
|
||||
for _, down := range []bool{true, false} {
|
||||
for {
|
||||
select {
|
||||
case event := <-listener.Events():
|
||||
if event.Name != "a" {
|
||||
continue
|
||||
}
|
||||
if event.Pressed != down || event.Keycode == 0 || event.Repeat {
|
||||
t.Fatalf("injected transition = %+v; expected pressed=%v", event, down)
|
||||
}
|
||||
case <-ctx.Done():
|
||||
t.Fatal("injected transition missing from observer")
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
if listener.Overflow() != 0 {
|
||||
t.Fatal("unexpected observer overflow")
|
||||
}
|
||||
t.Log("XTEST press/release enter the ordinary XRecord event stream; local provenance remains unresolved")
|
||||
}
|
||||
Reference in new issue
Block a user