Harden VNC server, IPC, and management plumbing

This commit is contained in:
Viktor Liu
2026-05-24 16:02:36 +02:00
parent f557e665a5
commit 5e2830be8a
29 changed files with 1433 additions and 105 deletions
+10 -8
View File
@@ -421,18 +421,20 @@ func createKillOnCloseJob() (windows.Handle, error) {
return job, nil
}
// Resolve returns the current agent socket path and token. When no
// agent is spawned yet (initial boot, between session switches, or
// permanently disabled when SE_TCB_NAME is missing) it surfaces a
// distinct error so the daemon can reject the connection with a
// meaningful message instead of timing out the proxy dial.
func (m *sessionManager) Resolve(_ context.Context) (string, string, error) {
// Resolve returns the current agent socket path, shared token, and the
// uid the agent runs under (0 on Windows since the agent runs as
// SYSTEM in the interactive session; validateAgentPeer is a no-op
// there). When no agent is spawned yet (initial boot, between session
// switches, or permanently disabled when SE_TCB_NAME is missing) it
// surfaces a distinct error so the daemon can reject the connection
// with a meaningful message instead of timing out the proxy dial.
func (m *sessionManager) Resolve(_ context.Context) (string, string, uint32, error) {
m.mu.Lock()
defer m.mu.Unlock()
if m.socketPath == "" {
return "", "", errAgentNotReady
return "", "", 0, errAgentNotReady
}
return m.socketPath, m.authToken, nil
return m.socketPath, m.authToken, 0, nil
}
var errAgentNotReady = errors.New("VNC agent not running yet")