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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Bind unattended updates to complete stable release objects
pulse-triage[bot]01b910fcda96
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex 15490caa2b..f51bf26dbe 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -5173,6 +5173,19 @@ miswritten upstream signal cannot cross a stable-channel install onto apreview tag. Dedicated prerelease-refusal tests in`scripts/installtests/pulse_auto_update_test.go` are the owned proof surfacefor that guard.+Unattended release discovery must bind a stable-shaped tag to explicit JSON+`draft=false` and `prerelease=false` in the same complete top-level release+object. Whitespace, key ordering, nested/body data, sibling objects, truncated+or concatenated documents and partial failed HTTP output cannot establish+maturity. The list remains highest-version-first; its fallback must be a+complete independently confirmed `/releases/latest` object, never a redirect+alone. Missing `jq` stops before transport. Both HTTPS API reads ignore ambient+curl configuration and have five-second connect/twenty-second overall bounds.+`TestAutoUpdateReleaseMetadataAdmission` and+`TestAutoUpdateReleaseMetadataRequiresParserBeforeTransport` in+`scripts/installtests/pulse_auto_update_test.go` own this proof. Signature,+edition, consent, backup, service-restoration and installation gates remain+separate and unchanged.That same boundary also owns operator-facing management entry points forexisting self-hosted installs: the installer's printed update/reset/uninstallcommands and the active install or upgrade docs must route supporteddiff --git a/scripts/installtests/pulse_auto_update_test.go b/scripts/installtests/pulse_auto_update_test.goindex 99e697a2f9..d0f5177264 100644--- a/scripts/installtests/pulse_auto_update_test.go+++ b/scripts/installtests/pulse_auto_update_test.go@@ -237,6 +237,7 @@ curl() {cat <<'EOF'{"tag_name": "v5.1.28",+ "draft": false,"prerelease": false,"name": "Pulse v5.1.28"}@@ -935,3 +936,100 @@ printf 'TRANSACTION_ASSERTIONS_PASSED\n't.Fatalf("transaction assertions did not finish:\n%s", out)}}++// Stable admission is object-bound, not a line-oriented tag/flag accumulator.+// Each fixture runs the real selector with local transport stubs only.+func TestAutoUpdateReleaseMetadataAdmission(t *testing.T) {+ const stable = `{"tag_name":"v6.5.0","draft":false,"prerelease":false}`+ cases := []struct {+ name, list, latest, want string+ listExit, calls int+ }{+ {"compact list", `[{"tag_name":"v6.4.5","draft":false,"prerelease":false},` + stable + `]`, `{}`, "v6.5.0", 0, 1},+ {"reordered fields", `[{"prerelease":false,"draft":false,"tag_name":"v6.5.0"}]`, `{}`, "v6.5.0", 0, 1},+ {"no sibling maturity borrowing", "[\n{\n\"draft\":true,\n\"prerelease\":false,\n\"tag_name\":\"v9.9.9\"\n},\n{\n\"prerelease\":false,\n\"draft\":false,\n\"tag_name\":\"v6.5.0\"\n}\n]", `{}`, "v6.5.0", 0, 1},+ {"confirmed latest fallback", `[]`, stable, "v6.5.0", 0, 2},+ {"missing draft", `[]`, "{\n\"tag_name\":\"v9.9.9\",\n\"prerelease\":false\n}", "", 0, 2},+ {"missing prerelease", `[]`, "{\n\"tag_name\":\"v9.9.9\",\n\"draft\":false\n}", "", 0, 2},+ {"draft latest", `[]`, "{\n\"tag_name\":\"v9.9.9\",\n\"draft\":true,\n\"prerelease\":false\n}", "", 0, 2},+ {"string flags", `[{"tag_name":"v9.9.9","draft":"false","prerelease":"false"}]`, `{}`, "", 0, 2},+ {"nested flags", `[{"tag_name":"v9.9.9","status":{"draft":false,"prerelease":false}}]`, `{}`, "", 0, 2},+ {"body is not release metadata", `[{"body":{"tag_name":"v9.9.9","draft":false,"prerelease":false}}]`, `{}`, "", 0, 2},+ {"wrong list shape", stable, `{}`, "", 0, 2},+ {"wrong latest shape", `[]`, `[` + stable + `]`, "", 0, 2},+ {"non-object entry", `[` + stable + `,false]`, `{}`, "", 0, 2},+ {"truncated list", `[` + stable + `,`, `{}`, "", 0, 2},+ {"concatenated documents", `[` + stable + `] []`, `{}`, "", 0, 2},+ {"partial transport output", `[` + stable + `]`, `{}`, "", 22, 2},+ {"transport failure with confirmed fallback", `[` + stable + `]`, stable, "v6.5.0", 22, 2},+ {"redirect is not maturity", `[]`, "Location: https://github.com/rcourtman/Pulse/releases/tag/v9.9.9\r\n", "", 0, 2},+ {"multiline tag", `[{"tag_name":"unknown\nv9.9.9","draft":false,"prerelease":false}]`, `{}`, "", 0, 2},+ {"preview and chart tags", `[{"tag_name":"v9.9.9-rc.1","draft":false,"prerelease":false},{"tag_name":"helm-chart-9.9.9","draft":false,"prerelease":false}]`, `{}`, "", 0, 2},+ }+ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ dir := t.TempDir()+ for name, data := range map[string]string{"list": tc.list, "latest": tc.latest} {+ if err := os.WriteFile(filepath.Join(dir, name), []byte(data), 0o600); err != nil {+ t.Fatal(err)+ }+ }+ script := `set -euo pipefail+GITHUB_REPO=rcourtman/Pulse+log() { printf '%s\n' "$*" >&2; }+curl() {+ printf '%s\n' "$*" >> "$FIXTURE_DIR/calls"+ local url="${!#}"+ case "$url" in+ */releases?per_page=30) cat "$FIXTURE_DIR/list"; return "$LIST_EXIT" ;;+ */releases/latest) cat "$FIXTURE_DIR/latest" ;;+ *) echo "UNEXPECTED_TRANSPORT" >&2; return 99 ;;+ esac+}+` + extractAutoUpdateFunction(t, "is_prerelease_tag") + "\n" ++ extractAutoUpdateFunction(t, "version_greater_than") + "\n" ++ extractAutoUpdateFunction(t, "pick_highest_stable_tag") + "\n" ++ extractAutoUpdateFunction(t, "get_latest_stable_version") + `+get_latest_stable_version+`+ cmd := exec.Command("bash", "-c", script)+ listExit := "0"+ if tc.listExit != 0 {+ listExit = "22"+ }+ cmd.Env = append(os.Environ(), "FIXTURE_DIR="+dir, "LIST_EXIT="+listExit)+ out, err := cmd.CombinedOutput()+ if err != nil || strings.TrimSpace(string(out)) != tc.want {+ t.Fatalf("release selection: %v; got %q, want %q", err, out, tc.want)+ }+ calls, err := os.ReadFile(filepath.Join(dir, "calls"))+ if err != nil {+ t.Fatal(err)+ }+ lines := strings.Split(strings.TrimSpace(string(calls)), "\n")+ if len(lines) != tc.calls {+ t.Fatalf("transport calls: got %d, want %d: %s", len(lines), tc.calls, calls)+ }+ for _, line := range lines {+ if !strings.HasPrefix(line, "--disable --fail --silent --show-error --connect-timeout 5 --max-time 20 --proto =https https://api.github.com/repos/rcourtman/Pulse/") {+ t.Fatalf("unbounded or ambient-config transport: %s", line)+ }+ }+ })+ }+}++func TestAutoUpdateReleaseMetadataRequiresParserBeforeTransport(t *testing.T) {+ script := `set -euo pipefail+command() { if [[ "$*" == '-v jq' ]]; then return 1; fi; builtin command "$@"; }+log() { printf '%s\n' "$*" >&2; }+curl() { echo UNEXPECTED_TRANSPORT; return 99; }+` + extractAutoUpdateFunction(t, "get_latest_stable_version") + `+result=$(get_latest_stable_version)+[[ -z "$result" ]] && echo PARSER_REFUSED+`+ out, err := exec.Command("bash", "-c", script).CombinedOutput()+ if err != nil || !strings.Contains(string(out), "PARSER_REFUSED") || strings.Contains(string(out), "UNEXPECTED_TRANSPORT") {+ t.Fatalf("missing parser must stop before discovery: %v\n%s", err, out)+ }+}diff --git a/scripts/pulse-auto-update.sh b/scripts/pulse-auto-update.shindex a171639858..57e08b66bf 100755--- a/scripts/pulse-auto-update.sh+++ b/scripts/pulse-auto-update.sh@@ -211,92 +211,51 @@ pick_highest_stable_tag() {echo "$best"}-# Get latest stable release from GitHub+# Get latest stable release from GitHub. Maturity and tag must come from the+# same complete release object, independent of JSON whitespace or field order.get_latest_stable_version() {- local latest_version=""- local release_json=""- local is_prerelease_flag=""-- # Primary: highest stable version across the release list. GitHub's- # /releases/latest points at the most recently *created* stable release,- # and this repo interleaves v5-line maintenance releases with v6 releases- # (v5.1.36 shipped the day before v6.0.5) — so "latest" can be an older- # version line, which would strand v6 installs until the next v6 release.- #- # Each tag is only a candidate when its own release object says- # draft=false and prerelease=false (field order per object is- # tag_name → draft → prerelease, with body last, so a pending tag is- # confirmed or discarded before the next object's tag_name resets it).- # pick_highest_stable_tag then re-applies the fail-closed shape check.- local releases_json=""- releases_json=$(curl -s "https://api.github.com/repos/$GITHUB_REPO/releases?per_page=30" || true)- if [[ -n "$releases_json" ]] && [[ "$releases_json" != *"rate limit"* ]]; then- local line="" pending_tag="" stable_tags=""- while IFS= read -r line; do- if [[ "$line" == *'"tag_name":'* ]]; then- pending_tag=$(printf '%s' "$line" | sed -E 's/.*"tag_name":[[:space:]]*"([^"]+)".*/\1/')- fi- if [[ "$line" == *'"draft": true'* ]] || [[ "$line" == *'"draft":true'* ]]; then- pending_tag=""- fi- if [[ "$line" == *'"prerelease":'* ]]; then- if [[ -n "$pending_tag" ]] && { [[ "$line" == *'"prerelease": false'* ]] || [[ "$line" == *'"prerelease":false'* ]]; }; then- stable_tags+="$pending_tag"$'\n'- fi- pending_tag=""- fi- done <<< "$releases_json"- latest_version=$(printf '%s' "$stable_tags" | pick_highest_stable_tag)- if [[ -n "$latest_version" ]]; then- echo "$latest_version"- return 0- fi- fi-- # Fallback: latest stable release (not pre-releases). `/releases/latest`- # already skips prereleases on GitHub's side, but we still parse and- # enforce the `prerelease` flag ourselves as a second line of defense.- release_json=$(curl -s "https://api.github.com/repos/$GITHUB_REPO/releases/latest" || true)-- if [[ -n "$release_json" ]] && [[ "$release_json" != *"rate limit"* ]]; then- latest_version=$(echo "$release_json" | \- grep '"tag_name":' | \- head -1 | \- sed -E 's/.*"tag_name":[[:space:]]*"([^"]+)".*/\1/' || true)- is_prerelease_flag=$(echo "$release_json" | \- grep '"prerelease":' | \- head -1 | \- sed -E 's/.*"prerelease":[[:space:]]*(true|false).*/\1/' || true)-- # Refuse if the API explicitly flags this release as a prerelease.- if [[ "$is_prerelease_flag" == "true" ]]; then- log error "GitHub /releases/latest returned a prerelease ($latest_version); refusing on stable channel"- echo ""- return 0- fi- fi-- # Check if we got rate limited or failed- if [[ -z "$latest_version" ]] || [[ "$latest_version" == *"rate limit"* ]]; then- # Try direct GitHub latest URL as fallback- latest_version=$(curl -sI "https://github.com/$GITHUB_REPO/releases/latest" | \- grep -i '^location:' | \- sed -E 's|.*tag/([^[:space:]]+).*|\1|' | \- tr -d '\r' || true)- fi-- # Final belt-and-braces: never hand back a prerelease-shaped tag even- # if an upstream path told us it was stable. The channel-pinning policy- # lives in the Go server (EffectiveAutoUpdateEnabled gates this timer on- # stable only); refusing prerelease tag shapes here ensures the unattended- # script cannot cross the major-version boundary on a corrupted API reply.- if [[ -n "$latest_version" ]] && is_prerelease_tag "$latest_version"; then- log error "GitHub returned prerelease-shaped tag ($latest_version) as latest; refusing on stable channel"+ local endpoint="" release_json="" stable_tags="" latest_version=""+ if ! command -v jq >/dev/null 2>&1; then+ log error "jq is required to verify release metadata; no unattended update attempted"echo ""return 0fi- echo "${latest_version:-}"+ # Prefer the highest stable in the list, not GitHub's creation ordering.+ # If that read is unusable, /latest is a separate metadata-confirmed path.+ # A redirect alone cannot prove draft/prerelease status and is not used.+ for endpoint in 'releases?per_page=30' 'releases/latest'; do+ if ! release_json=$(curl --disable --fail --silent --show-error \+ --connect-timeout 5 --max-time 20 --proto '=https' \+ "https://api.github.com/repos/$GITHUB_REPO/$endpoint"); then+ continue+ fi+ # Slurp before selecting: truncated or concatenated JSON must not+ # leak a previously parsed tag. Ignore only ineligible release objects;+ # do not borrow missing flags from siblings, nested data or body text.+ if ! stable_tags=$(jq -er -s --arg endpoint "$endpoint" '+ if length != 1 then error("expected one release document") else .[0] end+ | if $endpoint == "releases/latest" then+ if type == "object" then [.] else error("expected a release object") end+ else+ if type == "array" then . else error("expected a release list") end+ end+ | if all(.[]; type == "object") then . else error("invalid release entry") end+ | .[]+ | select(.draft == false and .prerelease == false)+ | select((.tag_name | type) == "string")+ | .tag_name+ | select(test("\\Av?[0-9]+\\.[0-9]+\\.[0-9]+\\z"))+ ' <<< "$release_json" 2>/dev/null); then+ continue+ fi+ latest_version=$(printf '%s\n' "$stable_tags" | pick_highest_stable_tag)+ if [[ -n "$latest_version" ]]; then+ echo "$latest_version"+ return 0+ fi+ done+ echo ""}# Compare versions (returns 0 if v1 > v2, 1 if v1 <= v2)