Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Bind Proxmox install command tokens on first use

rcourtman90482607dad5
diff --git a/docs/AGENT_SECURITY.md b/docs/AGENT_SECURITY.md
index edc2b5c2d3..5fa1867738 100644
--- a/docs/AGENT_SECURITY.md
+++ b/docs/AGENT_SECURITY.md
@@ -42,6 +42,12 @@ When enabled, commands still flow through Pulse's command policy and approval
surfaces instead of silently turning every agent into an unrestricted remote
shell.
+Agent command tokens must be bound to a host or agent identity before command
+registration is accepted. Proxmox install-command tokens are the only first-use
+exception: because the server mints them before the installer knows the final
+hostname, Pulse binds them to the first command agent that registers with that
+token. Generic unbound `agent:exec` tokens still fail closed.
+
## Proxmox Deployment Choices
You do not need a Pulse agent on every Proxmox-related host just to see basic
@@ -59,9 +65,10 @@ answers your monitoring question:
Inside-guest runtime visibility is explicit. Installing the agent inside a VM or
LXC authorizes that guest-local agent to report Docker/Podman monitoring data
-according to its local module flags. A Proxmox node agent can also collect
-Docker container inventory from LXC guests through `pct exec`, but only when the
-server is started with `PULSE_ENABLE_PROXMOX_GUEST_DOCKER_INVENTORY=true`.
+according to its local module flags. A Proxmox node agent does not look inside
+LXCs by default. It can collect Docker container inventory from LXC guests
+through `pct exec`, but only when the server is started with
+`PULSE_ENABLE_PROXMOX_GUEST_DOCKER_INVENTORY=true`.
Inventory collection is disabled by default, can be VMID-allowlisted, and is
limited to the Docker page summary path: Docker host/runtime version, container
ID, name, image, state/status, ports, and aggregate `docker stats` counters.
diff --git a/docs/UNIFIED_AGENT.md b/docs/UNIFIED_AGENT.md
index 42f537ddf4..37878967e3 100644
--- a/docs/UNIFIED_AGENT.md
+++ b/docs/UNIFIED_AGENT.md
@@ -138,13 +138,15 @@ Docker/Podman inside a VM or LXC is monitored from inside that guest. Install th
Unified Agent in the guest when you want full Docker host, container, service,
and task inventory on the Docker page.
-Pulse does not use a Proxmox node agent to collect guest container inventory by
-default. The optional Proxmox-side LXC Docker hint is off unless the Pulse server
-is started with `PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION=true`. That hint
-uses `pct exec` only to check whether `/var/run/docker.sock` exists in a running
-LXC; it does not enumerate containers, images, environment variables, files, or
-processes. Use it only when operators are comfortable with Proxmox-side guest
-probing for placement hints.
+Pulse does not use a Proxmox node agent to look inside LXCs by default. The
+optional Proxmox-side LXC Docker hint is off unless the Pulse server is started
+with `PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION=true`. That hint uses
+`pct exec` only to check whether `/var/run/docker.sock` exists in a running LXC;
+it does not enumerate containers, images, environment variables, files, or
+processes. The stronger Proxmox-side LXC Docker inventory path is separately
+disabled unless the server is started with
+`PULSE_ENABLE_PROXMOX_GUEST_DOCKER_INVENTORY=true`. Use either path only when
+operators are comfortable with Proxmox-side guest probing.
## Installation Options
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 13530f6798..45843377c6 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -94,6 +94,7 @@ management, and fleet control surfaces.
67. `internal/hostagent/proxmox_setup.go`
68. `internal/remoteconfig/client.go`
69. `internal/agenttls/config.go`
+70. `internal/api/agent_exec_token_binding.go`
## Shared Boundaries
@@ -360,6 +361,13 @@ profile and assignment columns, but embedded table framing must route through
owner identity from the API-authenticated caller through the shared
server-side token owner helper; bootstrap deploy metadata may bind cluster,
job, target, and expected node, but not the human owner.
+ Command-agent WebSocket identity follows the same lifecycle/auth split:
+ install-command tokens that enable command execution may be minted before
+ the final agent ID is known, but only Pulse-minted PVE/PBS install-command
+ tokens may bind on first `/api/agent/ws` registration. That first-use bind
+ must persist the registering agent ID and hostname and become authoritative
+ for later command registration attempts; generic unbound `agent:exec`
+ tokens are not lifecycle credentials and must fail closed.
The canonical durable-principal vocabulary for those shared auth routes is
recorded in `docs/release-control/v6/internal/IDENTITY_INVARIANTS.md`; agent
lifecycle work may consume that identity but must not define a parallel
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index ede88c9b3e..c7da9b6393 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -103,6 +103,7 @@ product API routes free of maintainer commercial analytics.
68. `frontend-modern/src/api/ai.ts`
69. `frontend-modern/src/api/aiChat.ts`
70. `frontend-modern/src/api/patrol.ts`
+71. `internal/api/agent_exec_token_binding.go`
## Shared Boundaries
@@ -447,6 +448,15 @@ the canonical monitored-system blocked payload.
prompt injection, so API payload builders may pass structured product
context without turning raw resource identity into user-authored text or
disclosure authority.
+3d. Route command-agent WebSocket registration token semantics through
+ `internal/api/agent_exec_token_binding.go`, `internal/api/router.go`, and
+ `internal/api/contract_test.go` together. `agent:exec` tokens must already
+ be bound to the registering agent ID or hostname before `/api/agent/ws`
+ accepts command registration. The only first-use exception is a
+ Pulse-minted PVE/PBS install-command token carrying the governed install
+ metadata; that token may bind once to the first command agent ID and
+ hostname that registers, and a later different agent or hostname must be
+ rejected. Generic unbound `agent:exec` tokens remain fail-closed.
4. Route unified resource sensitivity, routing, and `aiSafeSummary` payload changes through `internal/api/resources.go`, `internal/api/contract_test.go`, and the canonical frontend resource consumer proofs together; resource governance metadata must not ship as an API-only or frontend-only heuristic
That same resource payload contract owns `aggregations.policyPosture` on
`/api/resources` and `/api/resources/stats`. The aggregation must be derived
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 13072a5f23..b81d5ab328 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -177,6 +177,12 @@ regression protection.
the same startup-only router rule: env opt-in may configure monitoring-owned
checker/collector callbacks, but normal protected request setup must not run
`pct`, scan LXC guests, or collect Docker inventory.
+ Agent command-token validation follows the same bounded router rule:
+ `internal/api/agent_exec_token_binding.go` may validate against the
+ in-memory API token registry and persist a single first-use binding for a
+ governed Proxmox install-command token, but it must not add guest scans,
+ monitor refreshes, broad persistence walks, or external calls to command
+ WebSocket registration.
Container runtime migration token minting follows that same rule: adding
server-derived owner metadata in `internal/api/router.go` must reuse the
already-authenticated request context or caller token and must not add
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index d894404684..a1f06dff6c 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -63,6 +63,7 @@ controls as normal product settings.
35. `scripts/telemetry_adoption_report.py`
36. `frontend-modern/src/components/Settings/DataHandlingPanel.tsx`
37. `frontend-modern/src/components/Settings/dataHandlingPanelModel.ts`
+38. `internal/api/agent_exec_token_binding.go`
## Shared Boundaries
@@ -321,6 +322,13 @@ the visible API-token manager: agent install command tokens, deploy bootstrap
tokens, enrollment runtime tokens, container runtime migration tokens, and
first-run/regenerated admin tokens must use the same shared server-side owner
setter rather than carrying owner identity in caller-controlled metadata.
+That same command-token trust boundary also owns first-use binding for
+Proxmox install-command tokens. `internal/api/agent_exec_token_binding.go` may
+persist `bound_agent_id`, `bound_hostname`, and `bound_at` only for
+Pulse-minted PVE/PBS install-command tokens when the command agent first
+registers. Generic unbound `agent:exec` tokens, or tokens already bound to a
+different hostname or agent ID, must fail closed so command execution cannot
+cross hosts through reusable bearer credentials.
Telemetry/privacy disclosures now also route through the shipped frontend docs
boundary: `frontend-modern/src/utils/docsLinks.ts` is the canonical frontend
owner for privacy-document URLs, while `frontend-modern/public/docs/PRIVACY.md`
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 3e9bbc7635..fb36257d64 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -65,6 +65,13 @@ state.
## Extension Points
+Shared command-agent token binding in `internal/api/agent_exec_token_binding.go`
+is API-owned adjacent infrastructure. Storage- and recovery-adjacent setup or
+diagnostics flows may observe the API-owned `bound_agent_id`,
+`bound_hostname`, and `bound_at` metadata, but they must not rebind generic
+`agent:exec` tokens or treat a Proxmox install-command token as recoverable for
+another host after the first command registration identity has been persisted.
+
Generated Proxmox setup-script, runtime host-agent setup, and installer
auto-registration changes that affect backup visibility permissions are
storage/recovery-adjacent: optional PVE `/storage` grants must remain effective
diff --git a/internal/api/agent_exec_token_binding.go b/internal/api/agent_exec_token_binding.go
new file mode 100644
index 0000000000..83e19439e2
--- /dev/null
+++ b/internal/api/agent_exec_token_binding.go
@@ -0,0 +1,124 @@
+package api
+
+import (
+ "strings"
+ "time"
+
+ "github.com/rcourtman/pulse-go-rewrite/internal/config"
+ "github.com/rs/zerolog/log"
+)
+
+const (
+ agentInstallIssuedViaConfig = "config_agent_install_command"
+ agentInstallIssuedViaHosted = "hosted_agent_install_command"
+)
+
+func (r *Router) validateAgentExecToken(token string, agentID string, hostname string) bool {
+ if r == nil || r.config == nil {
+ return false
+ }
+
+ requestedID := strings.TrimSpace(agentID)
+ requestedHost := strings.TrimSpace(hostname)
+
+ config.Mu.Lock()
+ record, ok := r.config.ValidateAPIToken(token)
+ if !ok {
+ config.Mu.Unlock()
+ return false
+ }
+
+ tokenID := record.ID
+ if !record.HasScope(config.ScopeAgentExec) {
+ config.Mu.Unlock()
+ log.Warn().
+ Str("token_id", tokenID).
+ Msg("Agent exec token missing required scope: agent:exec")
+ return false
+ }
+
+ boundID := strings.TrimSpace(record.Metadata["bound_agent_id"])
+ boundHost := strings.TrimSpace(record.Metadata["bound_hostname"])
+ if boundID == "" && boundHost == "" && canBindProxmoxAgentInstallExecToken(record, requestedID, requestedHost) {
+ issuedVia := strings.TrimSpace(record.Metadata["issued_via"])
+ installType := strings.TrimSpace(record.Metadata["install_type"])
+ if record.Metadata == nil {
+ record.Metadata = make(map[string]string)
+ }
+ record.Metadata["bound_agent_id"] = requestedID
+ record.Metadata["bound_hostname"] = requestedHost
+ record.Metadata["bound_at"] = time.Now().UTC().Format(time.RFC3339)
+ tokens := make([]config.APITokenRecord, len(r.config.APITokens))
+ copy(tokens, r.config.APITokens)
+ config.Mu.Unlock()
+
+ if r.persistence != nil {
+ if err := r.persistence.SaveAPITokens(tokens); err != nil {
+ log.Warn().
+ Err(err).
+ Str("token_id", tokenID).
+ Str("hostname", requestedHost).
+ Msg("Failed to persist first-use Proxmox agent exec token binding")
+ }
+ }
+
+ log.Info().
+ Str("token_id", tokenID).
+ Str("hostname", requestedHost).
+ Str("issued_via", issuedVia).
+ Str("install_type", installType).
+ Msg("Bound Proxmox agent install token to first command agent registration")
+ return true
+ }
+
+ if boundID == "" && boundHost == "" {
+ config.Mu.Unlock()
+ log.Warn().
+ Str("token_id", tokenID).
+ Msg("Agent exec token missing binding metadata")
+ return false
+ }
+
+ if boundHost != "" && strings.EqualFold(boundHost, requestedHost) {
+ config.Mu.Unlock()
+ return true
+ }
+
+ if boundID != "" && boundID == requestedID {
+ config.Mu.Unlock()
+ return true
+ }
+
+ config.Mu.Unlock()
+ log.Warn().
+ Str("token_id", tokenID).
+ Str("bound_id", boundID).
+ Str("bound_hostname", boundHost).
+ Str("requested_id", requestedID).
+ Str("requested_hostname", requestedHost).
+ Msg("Agent token mismatch: token is not bound to the registering agent")
+ return false
+}
+
+func canBindProxmoxAgentInstallExecToken(record *config.APITokenRecord, agentID string, hostname string) bool {
+ if record == nil || strings.TrimSpace(agentID) == "" || strings.TrimSpace(hostname) == "" {
+ return false
+ }
+ if strings.TrimSpace(record.Metadata["bound_agent_id"]) != "" ||
+ strings.TrimSpace(record.Metadata["bound_hostname"]) != "" {
+ return false
+ }
+
+ switch strings.TrimSpace(record.Metadata["install_type"]) {
+ case proxmoxInstallTypePVE, proxmoxInstallTypePBS:
+ default:
+ return false
+ }
+
+ switch strings.TrimSpace(record.Metadata["issued_via"]) {
+ case agentInstallIssuedViaConfig, agentInstallIssuedViaHosted:
+ return true
+ default:
+ return false
+ }
+}
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 80a2ce7de0..d8df162ec0 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -11431,6 +11431,80 @@ func TestContract_AgentExecWebSocketAcceptsLegacyHostnameBinding(t *testing.T) {
}
}
+func TestContract_AgentExecWebSocketBindsProxmoxInstallTokenOnFirstUse(t *testing.T) {
+ rawToken := "contract-agent-proxmox-install-token.12345678"
+ record := newTokenRecord(t, rawToken, []string{config.ScopeAgentExec, config.ScopeAgentReport}, map[string]string{
+ "install_type": "pve",
+ "issued_via": agentInstallIssuedViaConfig,
+ })
+ cfg := newTestConfigWithTokens(t, record)
+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")
+
+ ts := newIPv4HTTPServer(t, router.Handler())
+ defer ts.Close()
+
+ conn, _, err := websocket.DefaultDialer.Dial(wsURLForHTTP(ts.URL)+"/api/agent/ws", wsHeadersForHTTP(t, ts.URL))
+ if err != nil {
+ t.Fatalf("Dial: %v", err)
+ }
+
+ regMsg, err := agentexec.NewMessage(agentexec.MsgTypeAgentRegister, "", agentexec.AgentRegisterPayload{
+ AgentID: "agent-delly",
+ Hostname: "delly",
+ Version: "1.0.0",
+ Platform: "linux",
+ Token: rawToken,
+ })
+ if err != nil {
+ conn.Close()
+ t.Fatalf("NewMessage: %v", err)
+ }
+ if err := conn.WriteJSON(regMsg); err != nil {
+ conn.Close()
+ t.Fatalf("WriteJSON: %v", err)
+ }
+ reg := readRegisteredPayload(t, conn)
+ conn.Close()
+ if !reg.Success {
+ t.Fatalf("expected Pulse-minted Proxmox install token to bind on first command registration, got %q", reg.Message)
+ }
+
+ config.Mu.Lock()
+ if got := cfg.APITokens[0].Metadata["bound_hostname"]; got != "delly" {
+ config.Mu.Unlock()
+ t.Fatalf("bound_hostname = %q, want delly", got)
+ }
+ if got := cfg.APITokens[0].Metadata["bound_agent_id"]; got != "agent-delly" {
+ config.Mu.Unlock()
+ t.Fatalf("bound_agent_id = %q, want agent-delly", got)
+ }
+ config.Mu.Unlock()
+
+ conn, _, err = websocket.DefaultDialer.Dial(wsURLForHTTP(ts.URL)+"/api/agent/ws", wsHeadersForHTTP(t, ts.URL))
+ if err != nil {
+ t.Fatalf("Dial rebound: %v", err)
+ }
+ defer conn.Close()
+
+ regMsg, err = agentexec.NewMessage(agentexec.MsgTypeAgentRegister, "", agentexec.AgentRegisterPayload{
+ AgentID: "agent-other",
+ Hostname: "other-host",
+ Version: "1.0.0",
+ Platform: "linux",
+ Token: rawToken,
+ })
+ if err != nil {
+ t.Fatalf("NewMessage rebound: %v", err)
+ }
+ if err := conn.WriteJSON(regMsg); err != nil {
+ t.Fatalf("WriteJSON rebound: %v", err)
+ }
+ reg = readRegisteredPayload(t, conn)
+ if reg.Success {
+ t.Fatalf("expected first-use-bound Proxmox install token to reject a different command agent")
+ }
+}
+
func TestContract_AdminBypassFailsClosedOutsideDevMode(t *testing.T) {
t.Setenv("ALLOW_ADMIN_BYPASS", "1")
t.Setenv("PULSE_DEV", "")
diff --git a/internal/api/router.go b/internal/api/router.go
index b06d9d24fe..c1af9bf170 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -521,59 +521,7 @@ func (r *Router) setupRoutes() {
r.systemSettingsHandler = NewSystemSettingsHandler(r.config, r.persistence, r.wsHub, r.mtMonitor, r.monitor, r.reloadSystemSettings, r.reloadFunc)
// Agent execution server for AI tool use
- r.agentExecServer = agentexec.NewServer(func(token string, agentID string, hostname string) bool {
- // Validate agent tokens using the API tokens system with scope check
- if r.config == nil {
- return false
- }
- // Check the new API tokens system with scope validation
- if record, ok := r.config.ValidateAPIToken(token); ok {
- // SECURITY: Require agent:exec scope for WebSocket connections
- if !record.HasScope(config.ScopeAgentExec) {
- log.Warn().
- Str("token_id", record.ID).
- Msg("Agent exec token missing required scope: agent:exec")
- return false
- }
-
- boundID := strings.TrimSpace(record.Metadata["bound_agent_id"])
- boundHost := strings.TrimSpace(record.Metadata["bound_hostname"])
- if boundID == "" && boundHost == "" {
- log.Warn().
- Str("token_id", record.ID).
- Msg("Agent exec token missing binding metadata")
- return false
- }
-
- // Hostname binding is authoritative: enrollment-minted tokens carry
- // bound_hostname, and the agent's runtime agentID is derived locally
- // (/etc/machine-id or override) rather than from a server-canonical
- // form. Matching on hostname preserves the trust boundary ("the
- // bearer is running on the bound host") and is robust to the agent
- // reporting an agentID the server could not have predicted at
- // mint time.
- if boundHost != "" && strings.EqualFold(boundHost, strings.TrimSpace(hostname)) {
- return true
- }
-
- // Fall back to bound_agent_id equality for tokens minted through
- // paths that set it directly. Pre-enroll tokens and tokens rotated
- // by tests/contract suites use this form.
- if boundID != "" && boundID == agentID {
- return true
- }
-
- log.Warn().
- Str("token_id", record.ID).
- Str("bound_id", boundID).
- Str("bound_hostname", boundHost).
- Str("requested_id", agentID).
- Str("requested_hostname", strings.TrimSpace(hostname)).
- Msg("Agent token mismatch: token is not bound to the registering agent")
- return false
- }
- return false
- })
+ r.agentExecServer = agentexec.NewServer(r.validateAgentExecToken)
if r.monitor != nil {
r.configureProxmoxGuestDockerDetection(r.monitor)
}
diff --git a/internal/api/security_regression_test.go b/internal/api/security_regression_test.go
index 41b8a478e4..f43ff332ee 100644
--- a/internal/api/security_regression_test.go
+++ b/internal/api/security_regression_test.go
@@ -674,6 +674,98 @@ func TestSecurityTokens_AgentExecRejectsUnboundToken(t *testing.T) {
conn.Close()
}
+func TestSecurityTokens_ProxmoxInstallExecTokenBindsOnFirstCommandRegistration(t *testing.T) {
+ rawToken := "agent-install-token-123.12345678"
+ record := newTokenRecord(t, rawToken, []string{config.ScopeAgentExec, config.ScopeAgentReport}, map[string]string{
+ "install_type": "pve",
+ "issued_via": agentInstallIssuedViaConfig,
+ })
+ cfg := newTestConfigWithTokens(t, record)
+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")
+
+ ts := newIPv4HTTPServer(t, router.Handler())
+ defer ts.Close()
+
+ wsURL := wsURLForHTTP(ts.URL) + "/api/agent/ws"
+ conn, _, err := websocket.DefaultDialer.Dial(wsURL, wsHeadersForHTTP(t, ts.URL))
+ if err != nil {
+ t.Fatalf("Dial: %v", err)
+ }
+ regMsg, err := agentexec.NewMessage(agentexec.MsgTypeAgentRegister, "", agentexec.AgentRegisterPayload{
+ AgentID: "machine-id-agent",
+ Hostname: "delly",
+ Version: "1.0.0",
+ Platform: "linux",
+ Token: rawToken,
+ })
+ if err != nil {
+ conn.Close()
+ t.Fatalf("NewMessage: %v", err)
+ }
+ if err := conn.WriteJSON(regMsg); err != nil {
+ conn.Close()
+ t.Fatalf("WriteJSON: %v", err)
+ }
+ reg := readRegisteredPayload(t, conn)
+ if !reg.Success {
+ conn.Close()
+ t.Fatalf("expected Pulse-minted Proxmox install token to bind on first command registration, got %q", reg.Message)
+ }
+ conn.Close()
+
+ config.Mu.Lock()
+ if got := cfg.APITokens[0].Metadata["bound_hostname"]; got != "delly" {
+ config.Mu.Unlock()
+ t.Fatalf("bound_hostname = %q, want delly", got)
+ }
+ if got := cfg.APITokens[0].Metadata["bound_agent_id"]; got != "machine-id-agent" {
+ config.Mu.Unlock()
+ t.Fatalf("bound_agent_id = %q, want machine-id-agent", got)
+ }
+ if got := cfg.APITokens[0].Metadata["bound_at"]; got == "" {
+ config.Mu.Unlock()
+ t.Fatalf("bound_at was not recorded")
+ }
+ config.Mu.Unlock()
+
+ persisted, err := config.NewConfigPersistence(cfg.DataPath).LoadAPITokens()
+ if err != nil {
+ t.Fatalf("LoadAPITokens: %v", err)
+ }
+ if len(persisted) != 1 {
+ t.Fatalf("persisted token count = %d, want 1", len(persisted))
+ }
+ if got := persisted[0].Metadata["bound_hostname"]; got != "delly" {
+ t.Fatalf("persisted bound_hostname = %q, want delly", got)
+ }
+
+ conn, _, err = websocket.DefaultDialer.Dial(wsURL, wsHeadersForHTTP(t, ts.URL))
+ if err != nil {
+ t.Fatalf("Dial attacker: %v", err)
+ }
+ regMsg, err = agentexec.NewMessage(agentexec.MsgTypeAgentRegister, "", agentexec.AgentRegisterPayload{
+ AgentID: "attacker-id",
+ Hostname: "other-host",
+ Version: "1.0.0",
+ Platform: "linux",
+ Token: rawToken,
+ })
+ if err != nil {
+ conn.Close()
+ t.Fatalf("NewMessage attacker: %v", err)
+ }
+ if err := conn.WriteJSON(regMsg); err != nil {
+ conn.Close()
+ t.Fatalf("WriteJSON attacker: %v", err)
+ }
+ reg = readRegisteredPayload(t, conn)
+ if reg.Success {
+ conn.Close()
+ t.Fatalf("expected first-use-bound install token to reject a different host")
+ }
+ conn.Close()
+}
+
func TestSecurityTokens_AgentExecRequiresAgentExecScope(t *testing.T) {
rawToken := "agent-scope-token-123.12345678"
record := newTokenRecord(t, rawToken, []string{config.ScopeAIChat}, nil)
diff --git a/internal/monitoring/canonical_guardrails_test.go b/internal/monitoring/canonical_guardrails_test.go
index 2858eb5193..f8392e517d 100644
--- a/internal/monitoring/canonical_guardrails_test.go
+++ b/internal/monitoring/canonical_guardrails_test.go
@@ -727,6 +727,42 @@ func TestProxmoxGuestDockerInventoryUsesCanonicalReportIngestPath(t *testing.T)
}
}
+func TestProxmoxGuestDockerLXCProbingRequiresExplicitOptIn(t *testing.T) {
+ requiredSnippets := map[string][]string{
+ "../config/config.go": {
+ "EnableProxmoxGuestDockerDetection bool",
+ `envconfig:"PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION" default:"false"`,
+ "EnableProxmoxGuestDockerInventory bool",
+ `envconfig:"PULSE_ENABLE_PROXMOX_GUEST_DOCKER_INVENTORY" default:"false"`,
+ },
+ "../api/router.go": {
+ "inventoryEnabled := r.config != nil && r.config.EnableProxmoxGuestDockerInventory",
+ "detectionEnabled := r.config != nil && (r.config.EnableProxmoxGuestDockerDetection || inventoryEnabled)",
+ "m.SetDockerChecker(nil)",
+ "m.SetDockerInventoryCollector(nil)",
+ "if inventoryEnabled {",
+ },
+ "../../docs/UNIFIED_AGENT.md": {
+ "Pulse does not use a Proxmox node agent to look inside LXCs by default.",
+ "`PULSE_ENABLE_PROXMOX_GUEST_DOCKER_DETECTION=true`",
+ "`PULSE_ENABLE_PROXMOX_GUEST_DOCKER_INVENTORY=true`",
+ },
+ }
+
+ for file, snippets := range requiredSnippets {
+ data, err := os.ReadFile(file)
+ if err != nil {
+ t.Fatalf("failed to read %s: %v", file, err)
+ }
+ source := string(data)
+ for _, snippet := range snippets {
+ if !strings.Contains(source, snippet) {
+ t.Fatalf("%s must contain %q", file, snippet)
+ }
+ }
+ }
+}
+
func TestBackupOrphanDetectionUsesCanonicalInventoryReadinessScope(t *testing.T) {
requiredSnippets := map[string][]string{
"monitor.go": {
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index a5c9ce406b..1c12bc42d2 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -3589,8 +3589,8 @@ class SubsystemLookupTest(unittest.TestCase):
{
"heading": "## Shared Boundaries",
"path": "internal/api/access_control_handlers.go",
- "line": 213,
- "heading_line": 107,
+ "line": 214,
+ "heading_line": 108,
}
],
)