Commit Graph

78 Commits

Author SHA1 Message Date
rcourtman
942d4b112c Harden agent identity ownership, scoping, and multi-tenant isolation
Restrict host and Docker uninstall alias recording and removal cascades
so one token cannot block or remove another enrolled host. Prevent
tokens already enrolled elsewhere from superseding stale host or Docker
records, and run Docker duplicate supersession only when creating a new
Docker host record.

Check persisted host ownership and stored Docker records directly during
identity resolution, and prefer exact HostID matches in continuity
lookups so forked records never capture a reinstalled host. Scope
Kubernetes cluster IDs per active token while allowing rotated tokens to
retain cluster records, prevent agent Ceph reports from hijacking
Proxmox or other active agents' Ceph records, scope Docker container
metric IDs by host, disable SSH temperature collection on non-default
tenants, and reload API tokens atomically under config.Mu.

Contract-Neutral: Security hardening for agent identity ownership, cross-host metric isolation, and multi-tenant reload/SSH boundaries without changing public API contracts.
2026-11-24 17:09:37 +00:00
rcourtman
6be44e133c Bound HTTP metrics, request bodies, JWTs, suppression, and downloads
Use registered ServeMux route patterns and fixed HTTP method labels in metrics, cap JSON request bodies across operator-state, maintenance review, resource links, alerts, auto-register, and AI handlers, bound handoff and purchase-return JWTs before parsing, bound TrueNAS topology parsing and JSON-RPC WebSocket message size, cap alert suppression reasons at 240 characters, and share bounded in-memory buffers with write deadlines for GitHub-proxied agent downloads.

Contract-Neutral: Security fixes bounding memory usage and label cardinality against OOM and DoS
2026-11-24 14:20:36 +00:00
rcourtman
8ecc77623d Compare effective cluster endpoint identity on address-change checks
Evaluate clusterEndpointAddressChanged against each member's effective
dial target via monitoring.PVEClusterEndpointURL and
proxmox.ClusterEndpointIdentity (matching clearMovedClusterEndpointChecks)
instead of comparing raw IPOverride strings. Equivalent URL spellings or
overrides that preserve a member's existing effective destination no
longer trigger spurious credential re-entry errors, while genuine host,
port, or target moves still require re-entering the credential.

Update TestPVEEndpointReachabilityAfterAddressEdit to supply the fixture
token value for the three subtests that genuinely move a member to a new
host or port, and expand TestHandleUpdateNode_StoredSecretDoesNotFollowAddressChange
to cover equivalent spellings, port changes, and effective-target matches.

Contract-Neutral: Security hardening follow-up without public contract change
2026-11-24 12:28:53 +00:00
rcourtman
83f17f12d2 Harden config import authority, tenant limits, SSO reload, and .env
Restrict updateEnvFile in ConfigPersistence so UPDATE_CHANNEL is only
written for supported canonical channels (stable or rc), preventing
multiline injection into .env.

Keep destination API tokens and SSO settings during POST
/api/config/import unless the caller is an instance administrator or
holds an instance-wide wildcard API token.

Apply tenant outbound destination limits and Apprise CLI restrictions
to organization administrator imports before staging any files.

Reload and publish restored SSO settings and withdraw stale cached OIDC
and SAML services after a default-organization import replaces SSO
configuration.

Contract-Neutral: Security hardening fix without public contract change
2026-11-24 12:28:52 +00:00
rcourtman
e48abea846 Enforce saved TLS pins across PVE cluster discovery and probes
Hold PVE cluster member validation in validateNodeAPI to the member's
saved pin (including explicit TLSFingerprintOverrides) or CA validation,
restricting first-use trust strictly to unpinned members under a pinned
primary. Add tlsutil.FetchVerifiedFingerprint and never overwrite saved
member pins or treat TLS failures as API auth denials.

Add monitoring.PVEEndpointFingerprint so diagnostics, cluster
re-detection, refresh-cluster, direct storage fallback, and port 443
fallback enforce the same per-endpoint pin polling uses and refuse
contradictory saved pins.

Contract-Neutral: Security hardening fix without public contract change
2026-11-24 12:28:52 +00:00
rcourtman
2350708f30 Harden node updates, cluster detection, PBS TLS, and reload scoping
Refuse PVE, PBS, and PMG node updates that change the host or a cluster
member override address while keeping a stored password or token value.

Probe PVE cluster detection from deep copies, re-locate the target
instance under config.Mu before storing results, guard PVE slice
removals under config.Mu, and return 409 Conflict if a connection is
removed or changed during cluster refresh.

Honor the requested VerifySSL and fingerprint settings during PBS
turnkey token creation in handleAddNode.

Scope non-default tenant node reloads to MultiTenantMonitor.ReloadTenant,
coalesce queued reloads in ReloadableMonitor.Reload, and space
auto-register reloads for existing connections per organization.

Contract-Neutral: Security hardening fix without public contract change
2026-11-24 12:28:52 +00:00
rcourtman
35f659408c Enforce org, host, TLS, and scope bounds in setup and register handlers
Close four authorization and TLS policy gaps in the Proxmox setup and agent install handlers:

- Refuse org-bound agent tokens in /api/auto-register outside their authorized organizations including default, and compare the WebSocket Upgrade header untrimmed to match auth middleware.
- Bind /api/auto-unregister setup tokens to the recorded host as spelled before marking a token used, in both live and recent grace-period branches.
- Record VerifySSLExplicit on PBS connections, prevent ungranted background agent re-registration from lowering VerifySSL or pinning an unverified certificate over chosen CA verification.
- Require callers requesting enableCommands on /api/agent-install-command to hold agent:exec themselves, and document the requirement in docs/API.md.

Contract-Neutral: Security hardening fix without public contract change
2026-11-24 12:28:52 +00:00
rcourtman
6af1b697bb Harden canonical auto-register TLS pins, ownership, and authority checks
Tighten canonical /api/auto-register authorization and identity matching across PVE, PBS, and cluster members:

- Require positive TLS pin agreement (ProxmoxFingerprintsMatch) before adopting a new address for a covered cluster member or moving a connection via an install grant.
- Prevent agent tokens from replacing an established TLS pin with a conflicting certificate on cluster members and top-level PVE and PBS connections.
- Require the registering host's own /cluster/status to confirm the cluster's saved host before refreshing a shared cluster token secret.
- Require exact-host matching before inferred matches, reject unresolved/unpinned agent-created preserved-host matches, and clear planted cluster metadata on DHCP continuity moves.
- Verify submitted Proxmox credentials against the target connection before saving agent-token updates, re-locate the slice slot after verification, compare owned endpoints without DNS resolution, and re-confirm agent token authority before mutating state.

Contract-Neutral: Security hardening fix without public contract change
2026-11-24 12:28:52 +00:00
rcourtman
f5dd8d276f Stop auto-granting VM.GuestAgent.FileRead in PVE 9+ setup
Proxmox cannot restrict VM.GuestAgent.FileRead to /proc/meminfo, so granting it on / via PulseMonitor gave every Pulse PVE token arbitrary guest file-read access as qemu-guest-agent (typically root) across all QGA-enabled VMs. Remove it from all four PVE setup surfaces (proxmox_setup.go, install.sh, setup_script_render.go including Setup Doctor, and Settings manual commands), extend optional /proc/meminfo HTTP 403 backoff to 30 minutes matching APT 403 handling, and document the risk and role-tightening command for existing PVE 9+ installs.
2026-11-23 16:36:10 +00:00
pulse-triage[bot]
91edd47b1c Use the normal runtime hooks in the concurrent connection test
Initialize the fixture's audit dependencies so the successful Edit branch can complete and its readback can be asserted.

Change-source: pulse-maintainer
2026-11-23 12:06:48 +00:00
pulse-triage[bot]
1712d98c2e Keep overlapping Proxmox refreshes and connection edits
Order explicit cluster refresh and connection edit saves and their reloads within the same configuration directory. Stage from the current inventory, do not commit cancelled discovery, and do not reuse discovery after its membership or saved endpoint inputs changed.

Contract-Neutral: Preserve the existing connection routes, response shapes, trust policy and save-before-reload outcomes; serialize same-configuration refresh and edit without changing how History is read.
Change-source: pulse-maintainer
2026-11-23 11:57:12 +00:00
pulse-triage[bot]
91a458af9c Stop abandoned Proxmox cluster discovery before saving
Bind explicit cluster refresh discovery to its caller, discard cancelled results before saving, and only publish the staged inventory on a successful save. Do not roll back an admitted save or skip applying it when its client disconnects.

Contract-Neutral: Keep the existing refresh route, connected response shapes, trust and tenant boundaries, and save-before-reload contract; stop abandoned discovery before save admission without changing completed or failed reload outcomes.
Change-source: pulse-maintainer
2026-11-23 10:40:20 +00:00
pulse-triage[bot]
fec2cc27b9 Keep Proxmox member checks with the address Pulse checked (#4931)
Saving a different effective member target must not carry its former
Pulse API result, check time or error into the saved connection.
Preserve siblings, equivalent addresses, Proxmox online evidence and
existing trust policy.

Contract-Neutral: Restores the existing requirement that an endpoint
observation describe the address Pulse checked. No API fields, dial
targets, trust policy, agent lifecycle or storage-recovery semantics
change.

---
Fleet candidate `20261122T225946Z-core-runtime` from the `core-runtime`
lane. Reviewed tip `70e941a451c328ad0b52ed8e00ee3c540675eae2` on `main`.

[How Pulse handles
triage](https://github.com/rcourtman/Pulse/blob/main/docs/AI_TRANSPARENCY.md)
2026-11-22 23:58:28 +00:00
pulse-triage[bot]
3716c46dc8 Report when a saved Proxmox refresh did not apply
A reload error after durable cluster refresh used to return the same success response as an applied refresh. Keep the saved row and its inventory event, but tell clients to read the connection before attempting another refresh. Preserve scopes, trust and existing runtime ownership.

Change-source: pulse-maintainer
2026-11-22 22:34:25 +00:00
pulse-triage[bot]
47b4b821fa Keep Proxmox member checks with the address Pulse checked
Saving a different effective member target must not carry its former Pulse API result, check time or error into the saved connection. Preserve siblings, equivalent addresses, Proxmox online evidence and existing trust policy.

Contract-Neutral: Restores the existing requirement that an endpoint observation describe the address Pulse checked. No API fields, dial targets, trust policy, agent lifecycle or storage-recovery semantics change.
Change-source: pulse-maintainer
2026-11-22 19:52:37 +00:00
pulse-triage[bot]
527a1eac19 Keep Test visible when the cluster result appears on phones
The first browser comparison found that the longer result pushed Test below the narrow editor viewport and clipped the physical disk heading at the end of the form. Report the count and the limits in fewer lines, and keep the TLS follow-up guidance compact.

Contract-Neutral: Copy only. The diagnostic categories, response fields, probe scope, trust, access and settings are unchanged.
Change-source: pulse-maintainer
2026-11-22 05:28:39 +00:00
pulse-triage[bot]
6a4663202c Keep Proxmox connection-test feedback within what was checked
Report the nodes listed by the tested PVE endpoint rather than implying every member passed. Keep the cluster cue while making clear that the test did not save anything or establish access to every member.

Replace advice to disable TLS verification or grant a blanket PVE role with guidance on verified certificates and intended read permissions. Keep the authentication and permission categories distinct.

Contract-Neutral: Changes explanatory text only. Request and response fields, HTTP statuses, probes, credentials, access, TLS trust, persistence, and polling are unchanged.
Change-source: pulse-maintainer
2026-11-22 05:20:01 +00:00
Richard Courtman
e4f344c12f Unify pre-generation agent install controls across general and Proxmox installers 2026-11-21 18:41:53 +00:00
courtmanr@gmail.com
e8beb0df4c Return actionable diagnostics for node connection test failures
2026-11-20 telemetry showed 58.6% of node connection tests failing on active installs (87.2% on inactive installs) because sanitizeErrorMessage collapsed every create_client and connection error into one generic string.

Map recognized HTTP 401/403, TLS certificate, protocol mismatch, connection refused, timeout, DNS, and unreachable errors to closed, static operator guidance without echoing raw error text, hostnames, IPs, or credentials. Verified with full internal/api/configapi tests and live Playwright checks in the Add Proxmox VE modal across desktop (1440x900) and mobile (390x844).
2026-11-20 18:07:12 +00:00
rcourtman
47dac2d7c8 Refuse short API tokens at setup and name the host install type
Quick setup takes the API token from the caller and makes it a full-access
token, but checked only that it was not empty. An agent following the API
reference, whose example value was "token", sent "automation" and it was
accepted. Setup now refuses a token under 32 characters before saving
anything. The wizard sends 48 and is unaffected.

The same run built an agent token by hand because the install-command
endpoint and its reference named only the Proxmox types. The refusal now
names host as well, and the reference describes the host token response
and links the scripted first run.
2026-11-15 14:03:46 +00:00
rcourtman
eb9549f5c1 Check auto-register authority before fetching certificates (#4351)
`/api/auto-register` completion picks a Proxmox connection's address by
fetching a TLS certificate fingerprint from the request's host and its
candidate addresses. This change reads the caller's authority before any
of those fetches.

- Setup tokens and install-grant holders still try every candidate, as
before.
- An agent token without an available install grant may change only the
connection its spent grant recorded, so Pulse now contacts only a
candidate spelled as that recorded address. Names are compared as
written, not resolved.
- The registration check makes no outbound connection and is unchanged.
- Adds a regression test for the auto-register and auto-unregister
parse-failure logs, which record the body size rather than the body.

Tests: new cases in
`internal/api/configapi/auto_register_probe_authority_test.go`. The two
agent-token cases fail on the previous handler, and the log case fails
if the body is logged again. The full `configapi` package and the
`internal/api` auto-register tests pass.
2026-11-14 01:04:22 +00:00
rcourtman
e0a98e49f1 Limit the addresses organization admins can connect Pulse to
An organization's owner or admin manages that organization's connections,
availability checks and email settings, but is not the instance operator.
Those routes connect from the Pulse server itself, so on a multi-org or
hosted install the address should not be one of the server's own.

Requests that RequireOrgAdmin or RequireOrgManager admit without instance
authority now carry a tenant outbound policy. Node, connection probe,
availability, TrueNAS, vCenter and SMTP destinations are refused with 403
when they are loopback, link-local, unspecified, multicast or a cloud
metadata address, and a host name is refused unless every address it
resolves to passes. Private networks stay allowed for shared-process
organizations and provider client runtimes, where tenants' systems sit on
the LAN or behind a VPN, and are closed on Pulse Cloud. Availability
checks are held to the policy whatever their observation locations, since
agent-only checks run on the server when the external probe entitlement
lapses.

The TrueNAS and vCenter clients also stop following redirects to another
host, matching the same-origin rule the Proxmox clients already apply; an
HTTP to HTTPS upgrade on the same host still follows.

Instance administrators, and so every single-tenant install, are not
affected.
2026-11-13 22:33:06 +00:00
rcourtman
1c314eb71f Check auto-register authority before fetching certificates
Completing /api/auto-register picks the connection address by fetching
a TLS certificate fingerprint from the request's host and each
candidate address, keeping the first that answers. That fetch ran
before the caller's authority was read, so any agent token could make
Pulse open TLS connections to addresses it may not change.

Completion now validates the candidates, binds the install grant and
reads the agent token's authority first, and only then fetches.
Setup tokens and install-grant holders still try every candidate. An
agent token without an available grant may change only the connection
its spent grant recorded, so Pulse contacts only a candidate spelled as
that recorded address, compared without resolving names: a name that
resolves to the recorded address when checked could dial another
address when Pulse connects.

The registration check makes no outbound connection and is unchanged.

Adds a regression test for the parse-failure log, which records the
body size rather than the body since the earlier auto-register
authority change.

Contract-Neutral: authorization ordering fix inside /api/auto-register; request and response shapes unchanged; api-contracts records the rule
2026-11-13 21:44:11 +00:00
rcourtman
e9198b0213 Limit agent-token auto-register to the token's recorded source
/api/auto-register accepts agent:report tokens so a Proxmox agent can
refresh the API token Pulse holds for its own node when that connection
stops working. Every monitored host holds such a token, including
Docker-only and Kubernetes-only hosts, and nothing an agent says about
itself (serverName, candidate addresses, its bound hostname, which a
command-enabled agent may rebind) proves which connection is its own.

The proof is the install grant. An admin-issued, first-host-bound,
expiring grant may still adopt or create a source, and spending it
records the connection address on the token. Without an available grant,
an agent token may now refresh the credentials of an existing PVE or PBS
connection, or a cluster member, only at that recorded address, and the
stored address and TLS pin stay as they are. Anything else is a 403 that
changes nothing. The registration check reports canRegister on the same
terms, so an agent does not rotate a credential it cannot register.

Setup-token registration and install-grant creation and adoption are
unchanged. An agent whose token never spent a grant keeps its current
connection instead of replacing it; reinstalling the agent from a fresh
install command, or re-running the node setup, refreshes it.

The handler also stops logging the raw request body when auto-register
or auto-unregister JSON fails to parse, and logs its size instead.

Contract-Neutral: authorization fix inside /api/auto-register; request and response shapes unchanged; api-contracts records the rule
2026-11-09 21:11:23 +00:00
rcourtman
cdb395e00a fix(notifications): retain acknowledged delivery continuity
Persist destination generations and accepted occurrence facts before final queue settlement. Hold delivery across incomplete restore while alert detection continues. Keep shared producer admission and operator disposition tracked in L6.
2026-11-05 23:42:41 +00:00
rcourtman
5719bd4b7b Stop routers when internal/api tests end
No Router built by the internal/api tests was ever freed. At the end of a run
all 1,358 were still reachable, with 26,000 goroutines and 2.86 GiB live, so
peak memory grew with every new test until the release correctness job ran out
of memory on its 7 GiB runner.

Most test sites never stopped their Router's workers. The few that did were
pinned anyway, because the setup-token cleanup worker in ConfigHandlers had no
way to stop and holds callbacks back into the Router. That worker now joins
the Router's shutdown, and package tests build Routers through newTestRouter,
which stops them with the test. Two new tests fail if a Router stays reachable
after shutdown or a package test calls NewRouter directly.

Default command policies now share one compiled pattern set. A private copy
cost 230 KiB and 1.4 ms per call and is now 2.2 KiB and 1.6 us. It accounted
for a quarter of the live test heap. In production each organization's AI
service holds one, so this also saves about 230 KiB per organization.

Measured on pulse-dev at 88c2a21f65 with the same go test -count=1 -p 1 run:
peak RSS of the largest child 6.41 GiB before, 2.44 GiB after. That largest
child is now the compiler: a cold test build alone peaks at 2.34 GiB and the
test binary alone at 1.48 GiB. All package tests pass. CPU time fell about 5%;
wall clock followed the host's load and is not comparable between these runs.

Contract-Neutral: Stops test Router workers and shares compiled policy patterns; no API, policy decision or storage change.
2026-11-05 11:18:30 +00:00
pulse-triage[bot]
56f1c36317 Start reload credential witnesses with a canonical organisation
The saved-token control omitted its organisation, so the normal loader correctly migrated it and rewrote its encrypted file before shutdown. Use an already canonical default-org record; retain the failed aggregate and keep the byte-for-byte credential and key preservation assertions.

Contract-Neutral: Corrects a test fixture to the existing persisted-token contract; runtime and public interfaces are unchanged.
Change-source: pulse-maintainer
2026-11-04 12:32:24 +00:00
pulse-triage[bot]
9bdc54dc0e Retain incompletely stopped tenants before a monitor reload
A full reload discarded the manager after a tenant loop exceeded its shutdown budget, then reported success and admitted replacement runtimes. Collect every incomplete tenant result, retain the retired owner and return the existing failed-apply response until cleanup can complete. Successful handovers, admission fencing and shutdown budgets stay unchanged. The HTTP regression releases its callback and recovers the saved endpoint, credential inventory and key through the normal reload path.

Contract-Neutral: Enforces the existing retained-runtime ownership, fail-closed retirement and saved-removal/TLS invariants. Public interfaces, response formats, scopes and shutdown budgets are unchanged; claimed contract files remain untouched.
Change-source: pulse-maintainer
2026-11-04 12:25:56 +00:00
pulse-triage[bot]
7e5c44229e Give the reload controls valid saved provider credentials
The first aggregate stopped at config validation, before tenant drain. Use inert synthetic credentials on disabled HTTPS fixtures so the controls reach the intended handover; retain that failed attempt without attributing it to the product.

Contract-Neutral: Test fixture correction only; no production or public contract delta.
Change-source: pulse-maintainer
2026-11-04 12:11:41 +00:00
pulse-triage[bot]
906f7b96ea Reproduce replacement of an incompletely stopped monitor
Cover the real removal handler and reload handshake with an admitted connection check held through cancellation. Keep both managers owned and release all fixture work during cleanup.

Contract-Neutral: Regression coverage for existing retained-runtime, saved-removal and TLS-preservation obligations; no production or public contract delta.
Change-source: pulse-maintainer
2026-11-04 12:07:27 +00:00
rcourtman
b8f9c51119 Harden protected response media and security test fixtures
Pin non-executable media at guarded HTTP write and flush boundaries so
protected output cannot become executable through missing or unsafe types.
Preserve payload bytes and existing credential-withdrawal semantics.

Key configuration-import replay fingerprints per guard rather than retain
unkeyed passphrase-derived digests. Limit installer fixture redirects to
fixed assets, require TLS 1.2, and make dependency-test expectations explicit.
2026-11-02 22:00:40 +00:00
pulse-triage[bot]
739a1b37af Distinguish container SSH setup refusal from legacy collection
Keep the key-generation restriction and legacy warn-and-use collector unchanged. Distinguish their diagnostics and prove refused setup preserves existing keys, while synthetic collection still requires a usable key and strict host-key trust. No real SSH host is contacted.

Contract-Neutral: Diagnostic text, accurate comments and normal-suite regression coverage only; key setup, SSH collection, host-key verification, credentials and runtime contracts are unchanged.
Change-source: pulse-maintainer
2026-10-31 18:40:10 +00:00
pulse-triage[bot]
af1b1a48bd Keep disabled collection scopes intact when editing TLS trust
Return false values for the existing PVE collection fields instead of omitting them. Otherwise the consuming editor substitutes enabled defaults and a trust-only save can re-enable guest, storage or backup collection. Cover the actual response and complete-scope update round-trip.

Change-source: pulse-maintainer
2026-10-27 07:32:14 +00:00
pulse-triage[bot]
f468b24fc4 Distinguish unknown member trust from explicit CA validation
Expose first-use state alongside effective endpoint trust so the existing editor can require a deliberate CA choice rather than infer one from an empty field. Add renewed untrusted-leaf controls to prove that clearing scoped pins does not bypass normal verification.

Contract-Neutral: The changed API projection is documented and verified here; shared API-prefix references introduce no delta to the existing agent-lifecycle or storage-recovery contracts updated in aa8e809fc8.
Change-source: pulse-maintainer
2026-10-27 07:27:43 +00:00
pulse-triage[bot]
c0730bd99c Retain effective TLS response frames in polling regression diagnostics
Bind consuming editor proof to the actual saved-node projection and single-endpoint probe responses; fixture endpoints and credentials are synthetic. The same test continues to assert TLS isolation, encrypted reload, ordinary polling and no mutation.

Contract-Neutral: Regression diagnostics only; no product or contract change.
Change-source: pulse-maintainer
2026-10-27 07:17:51 +00:00
pulse-triage[bot]
00cf46e324 Keep explicit TLS choices stable through consolidation and projection
Use the effective primary trust when reopening the editor, retain an explicit CA choice during instance consolidation, and reject contradictory equivalent trust scopes. Correct the synthetic leaf signer and initialise persistence before injecting the failed-save control.

Contract-Neutral: Completes the exact-endpoint TLS contract in aa8e809fc8 without another payload or policy change.
Change-source: pulse-maintainer
2026-10-27 07:14:50 +00:00
pulse-triage[bot]
aa8e809fc8 Apply managed Proxmox TLS trust to exact polling endpoints
Persist endpoint-scoped decisions alongside discovery pins, including explicit CA mode, without clearing unrelated member trust or accepting renewed certificates automatically. Use the same policy for saved-credential probes, qualify their scope, and keep failed saves out of live PVE configuration.

Change-source: pulse-maintainer
2026-10-27 07:07:44 +00:00
pulse-triage[bot]
f0e7eef1ef Give configuration recovery fixtures valid synthetic authentication
The new disabled-node fixtures still pass through normal configuration validation. Supply synthetic read-only-shaped credentials so the tests reach live reload failures instead of the earlier configuration-load rejection. No production or frontend source changes.

Change-source: pulse-maintainer
2026-10-25 21:46:38 +00:00
pulse-triage[bot]
a6336ca57f Report incomplete configuration recovery without false success
Distinguish a committed archive from failed live settings reloads. Keep the existing recovery dialog and replay protection in charge, preserve independent reloads and return only bounded component names. Cover real import faults, scoped router outcomes and the consuming error transport.

Contract-Neutral: Failure-reporting repair only: import routes, request and successful response shapes, scopes, stored archives and agent lifecycle are unchanged.
Change-source: pulse-maintainer
2026-10-25 21:32:01 +00:00
rcourtman
dab7582c95 Let NOPASSWD sudo users run the agent install command
The copied Unix install and setup commands settled sudo with `sudo -v`
before the silent token prompt. sudo applies its verifypw rule to -v, so
it asks for a password whenever any matching sudoers entry needs one,
even if the rule that would run a command is NOPASSWD. Ubuntu cloud
images match both `%sudo ALL=(ALL:ALL) ALL` and the cloud-init NOPASSWD
rule, and the default user there has no password, so the command failed
with "a password is required" for exactly the hosts most providers spin
up. Found while installing an agent on a fresh MSP client VM.

The preflight now tries a silent `sudo -n true` first. It runs a
command, so sudo applies the rule it would actually use, and it passes
for NOPASSWD users and cached credentials. Otherwise the old `sudo -v`
runs unchanged, so hosts that need a password are prompted as before and
a policy that allows only bash (where `true` is denied) still validates.
Both producers (the Go install command builder and the frontend one)
change together, and their tests pin the new preflight; the bootstrap
fixtures' fake sudo answers `-n true` the way it answers `-v`, so the
refusal cases still refuse.

Verified on an Ubuntu 24.04 cloud-init host: the old preflight prints
"sudo: a password is required", the new one passes without a prompt. The
Settings installer renders the new preflight in every Unix command at
desktop and phone widths.

Contract-Neutral: sudo preflight only; command shape, privilege dispatch and token handling unchanged
2026-10-25 19:41:18 +00:00
rcourtman
8ffc9253e1 Store tenant agent install tokens where agents authenticate
A provider MSP client workspace is a tenant organization of a hosted
runtime. Settings > Infrastructure minted its agent install tokens into the
org's own config copy (configapi getContextState). Agents never send
X-Pulse-Org-ID, so auth only looks them up in the instance inventory and
routes them by the token's org binding. Every agent installed from a client
workspace got 401 on every report, on v6.5.0 and v6.6.0, so a provider's
first client never received data.

The control plane's hosted install command already stored org-bound tokens
in the instance inventory, but bridged the tenant monitor with an
in-memory copy that agent removal revoked alone, that a tenant reload
dropped, and that diverged from the instance record. Store a tenant org's
tokens only in the instance inventory, from both paths, and let the tenant
monitor read them through Monitor.APITokenInventories: its own config, then
the instance records bound only to its org. Proxmox bootstrap and
auto-register, install-time command policy, Connections, Agent Doctor and
removal revocation now act on the record where it lives. Own config comes
first so a duplicate an earlier version persisted keeps its grant state,
and revocation commits in every inventory or in none. The default org and
single-runtime installs keep one inventory and are unchanged.

Tokens minted in a tenant org before this fix stay in the org copy and
still cannot authenticate; regenerating the install command fixes them.
2026-10-25 15:06:09 +00:00
pulse-triage[bot]
c26dd6d765 Complete synthetic node credentials in import-replay controls
The real loader correctly requires both token name and value, including for disabled fixture nodes. Supply the missing synthetic names so the controls reach runtime apply rather than fail validation. No runtime behavior or assertion is changed.

Change-source: pulse-maintainer
2026-10-25 08:33:56 +00:00
pulse-triage[bot]
3e6207804a Prevent configuration-import replays from overwriting newer edits
Keep one active import per workspace through persistence and runtime apply. Reject equal committed archive/passphrase requests for ten minutes, including after lost responses or failed apply, rather than repeat writes/reloads or report a cached success. Bound process-local admission without evicting live protection and release uncommitted failures for corrected retries. Preserve existing authentication, CSRF, tenant scope and complete legacy archives. Cover the real handler with response-loss, overlap, newer-edit, router and admission controls.

Change-source: pulse-maintainer
2026-10-25 08:29:34 +00:00
pulse-triage[bot]
a16f19c370 Keep recovery backups and legacy settings inside the import transaction
The full preservation controls exposed backup writes outside staging. Stage node and API-token backups, delay pruning until every section commits, and include the legacy settings-file update. Preserve normal non-import save behaviour and successful import backup retention; verify prior backups and settings survive failed recovery.

Contract-Neutral: Completes failure preservation for the existing configuration import transaction without changing archive formats, API response shape, tenant scope or ordinary save and backup-retention contracts.
Change-source: pulse-maintainer
2026-10-25 07:08:04 +00:00
pulse-triage[bot]
c794556acf Reproduce partial recovery when guest metadata cannot be imported
Cover false-success metadata failures, whole-file rollback and restored absence, plus HTTP failure audit and unchanged runtime controls.

Contract-Neutral: Adds regression controls for the existing configuration recovery transaction; no runtime, archive format, API or access contract changes.
Change-source: pulse-maintainer
2026-10-25 06:44:49 +00:00
pulse-triage[bot]
cc105e261b Reject incomplete configuration backups before replacement
Require the five sections emitted by every supported archive before starting a transaction. Preserve null webhook inventories, deliberate empty configurations, legacy optional fields and best-effort forward compatibility. Exercise encrypted rejected imports, byte-identical persistent state, unchanged runtime, failure audits and legacy recovery.

Contract-Neutral: Rejects incomplete non-backup payloads before the existing replacement transaction; emitted archive formats, supported complete legacy backups, API response shape and tenant authority remain unchanged.
Change-source: pulse-maintainer
2026-10-25 05:04:14 +00:00
pulse-triage[bot]
3b6483fce6 Keep tenant authentication bound to the current runtime owner
Use the configuration handler's locked monitor-manager reference for auth-context extraction and route revalidation, rather than capturing the manager that an instance reload replaces. Add synthetic old/new-owner, between-check replacement and removed-reference controls without exercising native reload or altering membership/scope rules.

Contract-Neutral: Maintains the existing current-owner credential validation and tenant-isolation invariants across monitor replacement; no public fields, scope grants, membership or reload policy change.
Change-source: pulse-maintainer
2026-10-25 01:43:58 +00:00
pulse-triage[bot]
d141bd5404 Apply configuration imports only to the selected tenant runtime
Reload non-default organisations through their own persisted runtime rather than copying the default config and restarting shared monitoring. Use the same scoped loader at cold start, retain process environment locks and instance identity, and fail closed when a scoped apply is unavailable. Keep the default instance reload and existing archive/auth contracts.

Contract-Neutral: Restores the existing selected-organisation isolation and recovery contract without changing archive formats, public API fields, authorization or guest/lifecycle guarantees.
Change-source: pulse-maintainer
2026-10-25 01:55:50 +01:00
rcourtman
d87c98cfab Stabilize private bootstrap and guest-agent HTTP fixtures
The two CI attempts for release preparation #3065 failed in fixture setup:
the PTY signalled a running Bash reader before input setup completed, and
an HTTP fixture inherited an earlier origin's uncertainty cooldown when
an ephemeral port was reused.

Wait for noncanonical, silent terminal input and a blocked Linux reader
before signalling. Isolate the shared guest-agent registry per serial
HTTP scenario while retaining admission sharing across its clients and
aliases. Move the existing isolation helper to the shared fixture file
and update its callers. Production guard and installer code are unchanged.

Both new regressions reproduce the old failures before the fixture fixes.
Retain those failures and the earlier unsuccessful compile proof. Source
test stabilization is separate from release qualification and publication.

Refs #3065
2026-10-18 22:57:44 +01:00
rcourtman
2fc54a5a1f Merge pending maintenance repairs with current main
Preserve selected memory freshness and the VM/LXC interpretation.
Retain both native tool contracts and current API concurrency controls.
Qualify this source separately from release and installed recovery.

Contract-Neutral: Integrate already-governed parents without a new contract change. Incoming verification files already match main. Fresh integration tests and source-bound browser proof cover the combined memory and installer surfaces.
2026-10-18 15:11:28 +01:00