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.

Observe compressed reports in the credential hand-off journey

pulse-triage[bot]f132b5b8fe0f
diff --git a/docs/UNIFIED_AGENT.md b/docs/UNIFIED_AGENT.md
index 5ad68125e4..446cc55e60 100644
--- a/docs/UNIFIED_AGENT.md
+++ b/docs/UNIFIED_AGENT.md
@@ -557,6 +557,15 @@ health/metrics endpoint over the network. Use `--health-addr ""` or
**Token resolution order**: `--token` → `--token-file` → `PULSE_TOKEN` → the `token` file in the state directory (`<state-dir>/token`; the default state directory is `/var/lib/pulse-agent` on Linux and macOS and `%ProgramData%\Pulse` on Windows).
+An explicitly selected token file must be readable by the agent service and
+contain a non-empty bare token, not quotes or a `PULSE_TOKEN=` assignment.
+Surrounding whitespace is ignored. A missing, unreadable or empty selected file
+stops startup rather than using an environment or implicit state-file token.
+The startup error does not print the file path or token. With `--enroll`, a
+previously stored non-empty `runtime.token` still takes precedence, so removing
+the bootstrap file does not break ordinary agent restarts. Do not share token
+contents, service environment contents or token hints when asking for help.
+
### Agent log level
The default `info` level records normal lifecycle and connection messages.
diff --git a/internal/api/host_agent_credential_handoff_test.go b/internal/api/host_agent_credential_handoff_test.go
index 85c91341fe..2b68edbbec 100644
--- a/internal/api/host_agent_credential_handoff_test.go
+++ b/internal/api/host_agent_credential_handoff_test.go
@@ -4,6 +4,7 @@ package api
import (
"bytes"
+ "compress/gzip"
"context"
"encoding/json"
"encoding/pem"
@@ -92,7 +93,20 @@ func TestHostAgentCredentialFileHandoff(t *testing.T) {
t.Error("could not observe synthetic report")
}
r.Body = io.NopCloser(bytes.NewReader(body))
- if err := json.Unmarshal(body, &event.report); err != nil {
+ // Observe the real wire encoding without changing the body
+ // delivered to the canonical router and decompressor.
+ var reportBody io.Reader = bytes.NewReader(body)
+ if r.Header.Get("Content-Encoding") == "gzip" {
+ compressed, err := gzip.NewReader(reportBody)
+ if err != nil {
+ t.Error("could not observe compressed synthetic report")
+ w.WriteHeader(http.StatusBadRequest)
+ return
+ }
+ defer compressed.Close()
+ reportBody = compressed
+ }
+ if err := json.NewDecoder(io.LimitReader(reportBody, 4<<20)).Decode(&event.report); err != nil {
t.Error("could not decode synthetic report")
}
}