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 runtime version to packaged binary

rcourtman0460797aabb2
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
index b7a577c1df..368ac1fe9a 100644
--- a/docs/release-control/v6/internal/subsystems/security-privacy.md
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -2239,3 +2239,15 @@ reports that effective policy rather than the environment variable alone, and
the root and shipped security guides remain byte-for-byte synchronized. The
router matrix proves that malformed and otherwise valid denied requests read no
body and perform no export, import, config replacement, or runtime reload.
+
+### Packaged server identity outranks inherited image metadata
+
+`pkg/server.Run` binds the version supplied by the executing binary into the
+canonical update/version subsystem before runtime initialization. Wrapper
+binaries such as Pulse Pro therefore report the same packaged identity through
+`/api/version` that they report through `--version`, even when a derived test
+container inherits a stale `VERSION` file from its base image. The public
+endpoint remains non-secret release metadata; this binding does not expose
+inventory, credentials, update selections, or command authority.
+`TestRunBindsPackagedVersionIdentity` in `pkg/server/server_test.go` pins the
+wrapper-runtime boundary.
diff --git a/pkg/server/server.go b/pkg/server/server.go
index 1267deb1ed..75051b64ad 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -29,6 +29,7 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/models"
"github.com/rcourtman/pulse-go-rewrite/internal/monitoring"
"github.com/rcourtman/pulse-go-rewrite/internal/telemetry"
+ "github.com/rcourtman/pulse-go-rewrite/internal/updates"
"github.com/rcourtman/pulse-go-rewrite/internal/websocket"
"github.com/rcourtman/pulse-go-rewrite/pkg/aicontracts"
@@ -139,8 +140,18 @@ func runtimeIdentityForBusinessHooks(h BusinessHooks) pkglicensing.RuntimeIdenti
return pkglicensing.CommunityRuntimeIdentity()
}
+func bindRuntimeVersion(version string) {
+ // The server package is also the entry point for wrapper binaries such as
+ // Pulse Pro. Keep the update/version subsystem bound to the version supplied
+ // by the executing binary so /api/version cannot fall back to a VERSION file
+ // inherited from its container image.
+ updates.BuildVersion = strings.TrimSpace(version)
+}
+
// Run starts the Pulse monitoring server.
func Run(ctx context.Context, version string) error {
+ bindRuntimeVersion(version)
+
// Initialize logger with baseline defaults for early startup logs
logging.Init(logging.Config{
Format: "auto",
diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go
index 84e8ee74ce..d5179afb34 100644
--- a/pkg/server/server_test.go
+++ b/pkg/server/server_test.go
@@ -16,11 +16,30 @@ import (
"github.com/rcourtman/pulse-go-rewrite/internal/agentexec"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
"github.com/rcourtman/pulse-go-rewrite/internal/securityutil"
+ "github.com/rcourtman/pulse-go-rewrite/internal/updates"
"github.com/rcourtman/pulse-go-rewrite/pkg/extensions"
pkglicensing "github.com/rcourtman/pulse-go-rewrite/pkg/licensing"
"github.com/rcourtman/pulse-go-rewrite/pkg/metrics"
)
+func TestRunBindsPackagedVersionIdentity(t *testing.T) {
+ previous := updates.BuildVersion
+ t.Cleanup(func() {
+ updates.BuildVersion = previous
+ })
+
+ updates.BuildVersion = "stale-image-version"
+ bindRuntimeVersion(" 6.2.2-patrol.qualification.5cffa5462 ")
+
+ versionInfo, err := updates.GetCurrentVersion()
+ if err != nil {
+ t.Fatalf("get current version: %v", err)
+ }
+ if got, want := versionInfo.Version, "6.2.2-patrol.qualification.5cffa5462"; got != want {
+ t.Fatalf("runtime version = %q, want packaged version %q", got, want)
+ }
+}
+
func TestAgentIngestHandler(t *testing.T) {
var innerCalled bool
inner := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {