Commit Graph

2048 Commits

Author SHA1 Message Date
pulse-triage[bot]
75a2a34855 Respect the selected agent credential file
Keep PULSE_TOKEN out of the direct-token flag default. Refuse an unreadable or empty selected file instead of silently borrowing other credentials, while preserving enrolled runtime-token restarts and implicit token-optional startup.

Cover actual flag loading and a synthetic host issuer, private installer-writer, compiled agent and trusted HTTPS lookup/report journey. This repairs an independent source-selection defect; it does not establish the cause or recovery of Discussion #2769.

Change-source: pulse-maintainer
2026-10-11 18:28:08 +01:00
pulse-triage[bot]
353be1ff00 Integrate reviewed Assistant retirement fixture repairs
Change-source: pulse-maintainer
2026-10-11 17:05:50 +01:00
rcourtman
149b55c3f9 Require an admin for non-token agent uninstall (#2833)
`POST /api/agents/agent/uninstall` (and `/api/agents/host/uninstall`) is
a collector's self-removal: a token holding `agent:report` removes the
agent that token owns. For any caller that is not a token, the handler
takes the administrative removal path (`RemoveHostAgent`) and deletes
any host agent by ID. The route was only `RequireAuth` plus
`RequireScope(agent:report)`, and browser sessions bypass token scopes,
so a non-admin SSO, proxy or organization-member session could remove
any agent, while the equivalent `unlink` and `DELETE` routes require an
admin.

The route now uses `RequireAdmin` like its neighbours. Token callers are
unchanged: `RequireAdmin` admits them and the `agent:report` scope check
still applies, so the collector's own uninstall and `install.ps1` keep
working (they are the only callers; the frontend does not use this
route).

`TestProxyAuthAdminGatesAdminEndpoints` gains the two uninstall routes
(it fails with the old wrapper: the non-admin request reached the
handler). `agent_uninstall_scope_test.go` keeps the token path reachable
and the scope check in place.
2026-10-11 16:56:42 +01:00
rcourtman
7482418db3 Admit attention lifecycle POSTs on the mutation scope (#2832)
`/api/ai/patrol/attention/` is one prefix for reads, lifecycle mutations
(`acknowledge`, `unacknowledge`, `suppress`, `unsuppress`) and action
planning. Its outer gate used the read-detail scope set
(`monitoring:read`, legacy `ai:execute`, `relay:mobile:access`) for
every method, so a token holding only `monitoring:write` was refused
before the mutation handler's own `monitoring:write` check could run.
The pinned capability inventory (`relay_mobile_capability_test.go`)
already says `POST .../{item_id}/{mutation}` needs `monitoring:write`.

The outer gate now follows `HandleAttention`'s dispatch: a lifecycle
mutation is admitted by the mutation scope set, everything else by the
read set. Behaviour that does not change: a read-only token still cannot
mutate, a write-only token still cannot read, action planning keeps its
read-side gate plus its own entitlement and plan/approve/execute
authorization, and browser sessions bypass scopes as before.

`attention_mutation_scope_test.go` pins each of those four cases and
fails when the mutation routing is reverted.
2026-10-11 16:30:40 +01:00
rcourtman
111a62cfe8 Require an admin for non-token agent uninstall
POST /api/agents/agent/uninstall (and its host alias) is a collector's
self-removal: a token holding agent:report removes the agent that token
owns. For any caller that is not a token, the handler instead takes the
administrative removal path and deletes any host agent by ID. The route
was only RequireAuth plus RequireScope(agent:report), and browser
sessions bypass token scopes, so a non-admin SSO, proxy or organization
member session could remove any agent, while the equivalent unlink and
delete routes require an admin.

The route now uses RequireAdmin like its neighbours. Token callers are
unchanged: RequireAdmin admits them and the agent:report scope check
still applies, so collector and install.ps1 self-uninstall keep working.

The existing non-admin proxy test gains the two uninstall routes, and a
new test keeps the token path reachable and the scope check in place.

Contract-Neutral: Behavioural fix that gives the administrative removal path the admin gate its sibling routes have; no new API surface or contract.
2026-10-11 16:30:23 +01:00
rcourtman
b161c42e31 Admit attention lifecycle POSTs on the mutation scope
/api/ai/patrol/attention/ is one prefix for reads, lifecycle mutations
(acknowledge, unacknowledge, suppress, unsuppress) and action planning.
Its outer gate used the read-detail scope set for every method, so a
token holding only monitoring:write was refused before the mutation
handler's own monitoring:write check ran. The pinned capability inventory
already says POST .../{item_id}/{mutation} needs monitoring:write.

The outer gate now follows the handler's dispatch: a lifecycle mutation
is admitted by the mutation scope set, everything else by the read set.
Read tokens still cannot mutate, a write-only token still cannot read,
and action planning keeps its read-side gate plus its own authorization.

Contract-Neutral: Behavioural fix that makes the route match its pinned capability inventory; no new API surface or contract.
2026-10-11 16:05:31 +01:00
rcourtman
9718555e31 Stop token callers widening or bypassing their scopes
Two authorization gaps where a token could do more than its scopes allow.

POST /api/security/regenerate-token replaces the whole token inventory,
wildcard tokens included, and issues a full-access credential (nil scopes
normalise to "*"). A token holding only settings:write could therefore
wipe every other token and mint an unrestricted one, which the normal
create and update paths refuse because a caller can only grant scopes it
holds. A token caller now needs full-access scope and must not be bound
to a non-default organization; anything narrower gets 403 and is pointed at
POST /api/security/tokens/{id}/rotate, which replaces one token. Admin
sessions are unchanged.

/api/resources/ is one prefix route gated on monitoring:read, but it also
dispatches POST link, unlink and report-merge, which persist resource
identity changes. A read-only token could change them. Anything other
than GET or HEAD on that prefix now needs monitoring:write; the more
specific registrations (operator-state, maintenance) keep their own gates.

Tests pin both boundaries and each fails when its fix is reverted. Two
existing regenerate tests that used a settings:write caller now use a
full-access one, since their subject is owner inheritance and rollback.

Contract-Neutral: Behavioural fix that enforces the documented token scope model; no new API surface or contract.
2026-10-11 15:57:35 +01:00
pulse-triage[bot]
8e20302041 Keep the real ZIP extraction limit without expensive fixture compression
The broader API race proof failed after 902 seconds with the oversized ZIP fixture among its unterminated tests; the missing panic output does not establish the cause. The fixture needlessly Deflates 100 MiB of zeros. Generate the same exact oversized entry with ZIP Store and streamed zero input instead, keeping the production cap, stream-limit assertion, archive validity and other Deflate controls unchanged.

Contract-Neutral: Only the ZIP overflow test fixture encoding and construction cost change; the actual oversized entry, runtime extraction policy, size bound, error assertions and test deadlines are unchanged.
Change-source: pulse-maintainer
2026-10-11 15:24:18 +01:00
rcourtman
fc667c2ae3 Merge remote-tracking branch 'origin/main' into pulse/sidecar-live 2026-10-11 12:35:42 +01:00
rcourtman
5d53fa7a3d Remove the Assistant mutation handlers nothing calls
pulse_control only plans typed resource actions into Pulse Actions
(executeControlResource -> typedActionPlanner). The handlers that sat
behind the retired model-authored command, file and container paths
stayed in the tree with no production caller: run command, guest
control, app-container control, Docker control and container update,
Kubernetes scale/restart/delete-pod/exec, and file append/write.
registerFileTools was never called either, so pulse_file_edit is not
registered at all; calls to it are denied by the mutation registry
before any tool lookup.

A whole-program reachability run over cmd/... lists each of them as
unreachable, and so is everything only they used: approval-record and
preflight authoring, the command and native-action audit lanes with
their remediation-lock gate and plan-hash helpers, the Docker host
resolvers, and the file write verification. The executor's autonomous
flag, whose only readers were those handlers, goes with them (the
executor's SetAutonomousMode and the flag argument of SetContext).

Delete them with their tests and the constants, types and test helpers
they stranded. The contract prose that described the removed broker now
says that plan freshness and the operator remediation lock are enforced
by internal/actionlifecycle. Two source pins that named deleted code go
(the publishActionCompleted dispatch sites and the pulse_file_edit
declaration), the standards tests drop their expectations of an
ActionPlan construction in action_audit.go and of the legacy app_container
rejection in the deleted file-edit test, and the RA35 evidence entry for
the deleted run-command test goes with them.

Left alone on purpose: the saved autonomous control level and its
entitlement and approval-admission checks, which stay as legacy
compatibility, Service.SetAutonomousMode and the chat clamp,
SetOnActionCompleted and its router wiring (no dispatcher is left, the
contract prose says so), and the protected-guests plumbing.

Rebuilt on current main: the first version had 213 commits of drift.
Two conflicts, both on code this change deletes. tools_control.go takes
the deletion over the Protected guests cleanup that landed inside
executeRunCommand. action_audit_remediation_lock_test.go goes with the
audit lanes, including the test added for the dispatch gate's read
through a succession; that gate is deleted here, and
TestLockMovedBySuccessionStillRefusesTheIDThePreviousGenerationLists in
internal/actionlifecycle covers the same refusal on the live path.
2026-10-11 12:35:28 +01:00
pulse-triage[bot]
235f0e42a2 Give TLS diagnostic controls their required runtime
Use the existing target-free Monitor fixture for diagnostics uptime and scheduler state; only the test's direct PVE/PBS probes contact its loopback server. Retain the initial nil-runtime failure without weakening production diagnostics or trust assertions.

Contract-Neutral: Tests only; supply the existing required diagnostics runtime without changing production source or diagnostic contracts.
Change-source: pulse-maintainer
2026-10-11 10:25:31 +01:00
pulse-triage[bot]
c0e11cf44a Keep diagnostic TLS recovery within saved trust
Distinguish cancelled or timed-out probes from certificate faults before classifying error text. Replace verification-bypass advice with endpoint, chain and independently verified fingerprint checks across PVE and PBS diagnostics, including scheduler errors and support JSON.

Exercise real loopback trust refusal and operator-supplied pin recovery without changing stored trust, credentials or scheduler authority.

Contract-Neutral: Restore existing TLS/timeout diagnosis and safe recovery guidance; errorKind/schema, saved trust enforcement/settings, agent lifecycle and scheduler/recovery authority remain unchanged.
Change-source: pulse-maintainer
2026-10-11 10:17:19 +01:00
pulse-triage[bot]
37864e1b4a Expose unsafe TLS recovery guidance in diagnostics
Discriminate advice that weakens certificate trust and stopped handshakes mislabelled as certificate faults, before repairing the existing diagnostic path.

Contract-Neutral: Tests only; no runtime, diagnostic schema or TLS policy change.
Change-source: pulse-maintainer
2026-10-11 10:05:21 +01:00
pulse-triage[bot]
816b20bfc5 Keep Docker update plans on the saved deployment
Replace the copyable guessed stop/run sequence with mounted-data backup and original-deployment recreation guidance. Quote the pull target as one literal shell argument, retaining manual-only and private-image boundaries. Add real-shell controls and a real handler-path check; no Docker daemon or installed recovery claim.

Change-source: pulse-maintainer
2026-10-11 07:14:41 +01:00
pulse-triage[bot]
91de06ca23 test(api): initialise persistent stores in bare auth fixtures
The exact normal and race API groups failed at the bare change-password fixture because Basic authentication requires an explicitly configured CSRF store. Give each fixture its own session and CSRF stores and join their workers at cleanup; retain the production fail-closed contract.

Contract-Neutral: Test fixture lifecycle only; production authentication and subsystem contracts are unchanged.
Change-source: pulse-maintainer
2026-10-11 01:22:36 +01:00
pulse-triage[bot]
da44cec421 fix(monitoring): publish complete resource wiring once
Apply saved notification policy before initial resource publication, batch supplemental bindings and retain explicit withdrawals for existing and future tenants. Serialize complete router initialization and refuse old binding collections before ordered writes; preserve admitted alert joins without clearing active alerts. Keep native and demo provider records separated across the mock-switch hook gap.

Contract-Neutral: Internal resource dependency wiring and publication ordering only; existing resource/API schemas, authorization and tenant boundaries, alert thresholds, retention and shutdown policy are unchanged.
Change-source: pulse-maintainer
2026-10-10 19:23:09 +01:00
pulse-triage[bot]
a61efb9cb3 Join runtime alert checks before tenant shutdown completes
Monitor.Start launched mock and connection alert passes without joining them. Tenant deletion could close stores and remove its directory while a pass still emitted alert writes. Wait for admitted passes, refuse new checks after cancellation, and retain the existing bounded-deletion refusal. Log real persistence deletion errors without exposing them in the API response.

Contract-Neutral: Preserve token scopes, tenant isolation, API responses and deletion safety contracts; bind existing internal alert passes to their monitor lifetime and retain failure diagnostics.
Change-source: pulse-maintainer
2026-10-10 16:47:05 +01:00
rcourtman
3465804dd1 Stop mock-mode callers that read identity rebuilding the estate view (#2798)
Follow-up to #2778. Stacks cleanly on main; the contract prose
cross-references the wiring change in #2796, so land that first if both
are open.

## What was wrong

In mock mode the unified view is keyed on the fixture data version,
which advances on every metric tick, and building it for the default
1,776-resource estate costs about half a second of CPU (many seconds on
a starved process). #2778 moved the metrics-target lookup onto the
fixture structure revision. The other callers that read only what the
estate lists and how it connects still rebuilt the whole view after each
tick: at startup they made 42 view requests, all misses (the
Docker-alert prune 18, the connection snapshots 13, the host-agent
evaluation 8, the chart prewarm 2, the metrics-target lookup 1), and
with no client connected the monitor tick alone rebuilt the estate about
every nine seconds.

## What changes

- Callers that read identity and topology share the view built for the
current structure revision and operator links
(`currentStructureUnifiedStateView`, `GetUnifiedStructureReadState`,
`currentModeStructureReadState`, in
`internal/monitoring/unified_structure_view.go`; `mockMetricsTarget`
uses the same cache reader): the Docker-alert prune, the workload chart
prewarm, the demo Patrol operator-state resolver, and the host-agent
evaluation. `evaluateHostAgents`, which runs on every monitor tick, now
lists nodes only when an offline host names a linked node.
- The connection-degraded alert feed keeps only platform rows
(`snapshotConnectionsForAlerts` drops every agent row, and a PBS row's
reported node name only becomes a host alias that its snapshot does not
carry). It now builds the aggregator inputs with `platformRowsOnly`, so
it no longer reads the hosts, their desired-config fingerprints or the
PBS instances. The connections endpoint, diagnostics and runtime
inventory still read them.
- Deliberately not moved:
- The mock storage chart (`resolveMockStorageTotal`): a linked pool
takes its capacity from whichever source was seen last, which a tick can
move without a structure change. It stays on the data-version view, read
once per request instead of once per uncached pool.
- `linkedHostForNode`, `getHostAgentTemperatureForNode` and
`carriedTemperatureOutlivesAgentLease` (only reachable with
`PULSE_MOCK_KEEP_REAL_POLLING`): they read a host's status, disks,
sensors and report lease, which a tick moves. Hoisting them would need
the read state threaded through the node poller, and they run after
startup, so they stay as they were.

Real mode is unchanged.

## Measured (pulse-dev, probe builds, one pinned core, GOMAXPROCS=1,
host load 30 to 110, single runs)

| | #2796 alone | with this change |
|---|---|---|
| estate view builds before the listener answers | 2 | 1 |
| estate builds, no client connected, 299 s of life | 33 | 2 (both at
startup) |
| process CPU over a 180 s steady window | 12.3 s | 3.3 s |

A separate run of the pre-#2796 build used 9.0 s over that window, so
read 12.3 against 3.3 as the comparison rather than as exact
percentages. The public demo host runs a mock estate, so the
steady-state saving is the one that matters there.

## Verification

- New tests (in registered proof files): no consumer of the structure
view rebuilds the view after a fixture tick (Docker prune, structure
node listing, workload prewarm, host-agent evaluation including an
offline host that names a linked node); the data-version view still
rebuilds; the structure view follows a structural fixture change and an
operator link; lazy correlation lists nodes only for a linked host; a
storage chart reads the estate only when it is not cached; the alert
feed does not rebuild the view, its platform rows equal the full
aggregator's, and configured PVE/PBS/PMG rows survive without the hosts;
the Patrol resolver does not rebuild the view.
- Negative controls (each fails the named test): prune, prewarm, eager
node listing, structure node listing, alert feed and Patrol resolver
each moved back to the data-version view, and a storage chart that reads
the estate before checking its cache.
- `go vet` and the targeted tests on pulse-dev.

## Known limits

- The structure view can be several ticks old, so a caller on it must
not read status, metric values, timestamps, sensors or anything a link
merges by freshness; the contract says so. The fixture sets pod node
names (which feed the platform aliases a Patrol reference can resolve
through) when the estate is built, not on a tick.
- `pbsInstanceFromReadStateView` never copies `NodeName`, so
`pbsReportedNodeNamesByInstance` appears to feed empty host aliases on
the connections endpoint. That is a separate bug, not changed here.
- The batch sharing of the storage chart's read (`sync.OnceValue` in
`GetStorageMetricsForChartBatch`) is not pinned by a test; the
single-chart laziness is.

Not a feature: no demand-ledger entry.
2026-10-10 13:44:54 +01:00
rcourtman
8823440f33 Stop mock-mode callers that read identity rebuilding the estate view
In mock mode the unified view is keyed on the fixture data version, which
advances on every metric tick, and building it for the default
1,776-resource estate costs about half a second of CPU (many seconds on a
starved process). #2778 moved the metrics-target lookup onto the fixture
structure revision; the other callers that read only what the estate
lists and how it connects still rebuilt the whole view after each tick.
At startup they made 42 view requests, all misses, and with no client
connected the monitor tick alone rebuilt the estate about every nine
seconds.

Callers that read identity and topology now share the view built for the
current structure revision and operator links (currentStructureUnifiedStateView,
GetUnifiedStructureReadState): the Docker-alert prune, the workload chart
prewarm, the demo Patrol resolver, and the host-agent evaluation, which
also lists nodes only when an offline host names a linked node. The
connection-degraded alert feed keeps only platform rows, so it no longer
reads the hosts, their desired-config fingerprints or the PBS instances
that only feed agent rows and a host alias its snapshot drops.

The mock storage chart is not one of them: a linked pool takes its
capacity from whichever source was seen last, which a tick can move
without a structure change. It keeps the data-version view, read once per
request instead of once per uncached pool. The per-node polling lookups
of a monitor that keeps real polling in mock mode (linkedHostForNode,
getHostAgentTemperatureForNode, carriedTemperatureOutlivesAgentLease)
read a host's status, disks and sensors, which a tick moves, so they stay
on the data-version view.

On pulse-dev (one pinned core, host load 30 to 110, probe builds): a
start built the estate view twice before the listener answered with the
wiring change alone and once with this; with no client connected the
process built the estate 33 times in 299 s and used 12.3 s of CPU over a
180 s window, against twice and 3.3 s with this change.
2026-10-10 12:37:42 +01:00
rcourtman
884694a046 Carry the PBS-reported node name into the connections ledger
The PBS poll records the hostname the node reports about itself on
PBSInstance.NodeName so /api/connections can alias the PBS connection by
it and group the host agent running on that machine into the PBS row.

The name reaches the unified PBS resource (PBSData.NodeName), but
Monitor.PBSInstancesSnapshot() rebuilds each instance from the read-state
view, and the view had no accessor for it, so the snapshot always carried
an empty NodeName. The ledger's reported-name map was therefore always
empty and a PBS machine configured by IP or DNS alias still showed as an
API row plus a separate agent row. The unit tests missed it because they
hand the aggregator its inputs instead of going through the monitor.

Add PBSInstanceView.NodeName() and copy it in pbsInstanceFromReadStateView.
The new ledger test drives a real monitor through the input builder, the
connection aliases and the system grouping: with the conversion line
removed it fails on the missing alias, with it the agent attaches to the
PBS system.

Only direct root@pam sessions can read the node name (API-token
connections get none), so this restores grouping for password-auth PBS
connections; token-auth ones still match only on what they were
configured with.
2026-10-10 12:06:38 +01:00
rcourtman
e885b8aced Undo only the links that hold a reported source in report-merge (#2780)
## Problem

A source-filtered `POST /api/resources/{id}/report-merge` picked the
links to undo by each fold's `Sources`, which is the folded side's whole
subtree. Two consequences:

- In a chain (Docker host linked into an agent linked into a VM), naming
only `docker` also split the agent from the VM, because the agent's fold
lists the Docker source it took in.
- Where recorded links form a cycle (S->V, W->V, S->W with V primary),
naming only `vmware` excluded V-W but left W-S, so W rejoined through S
on the next rebuild. `main` cannot record that cycle today (its third
link is skipped once W is folded), so this half is proved on hand-built
folds and will matter once chains record their closing links.

## Change

- `ManualLinkFold` records what each side is on its own (`HolderOwn`,
`FoldedOwn`), read before the other side is merged in. A repeated pair
unions them, as it does `Sources`.
- `ReportedManualLinkFolds` undoes the links that join a member carrying
a reported source to the part that stays, or to another reported member.
A member that hangs below a reported one and carries no reported source
goes with it, and its link stays. "The part that stays" is what the
resource still reaches without passing through a reported member, so a
reported member is cut from every link that would rejoin it.
- The handler uses it in place of `selected(fold.Sources...)`.

A report naming every source, or none, still undoes every link. The
drawer's Split sends every merged source, so it is unchanged; only API
callers with a real `sources` filter see a difference. No schema,
storage or response change.

## Proof

- `TestResourceReportMergeSourceFilterDetachesChainMembers`
(resourceapi): a Docker host linked into an agent linked into a VM,
reported for the leaf, the holder, both, every source and no filter,
checked on the monitor and the REST listing and against the links left
in the store.
-
`TestContract_ResourceReportMergeSourceFilterKeepsLinksOfUnreportedMembers`
(api).
- `TestReportedManualLinkFoldsDetachMembersCarryingTheSource` and
`TestReportedManualLinkFoldsLeaveNoReportedMemberJoined`
(unifiedresources): trees, the cycle above, the root re-keyed, folds
without own sources, a refold that gained a source. The second checks
that no reported member stays joined to the root; selecting by subtree
sources fails it on the cycle.
- Fold recording tests updated for the own sources; clone test checks
they are deep-copied.
- Negative controls on pulse-dev with the handler restored to the
subtree selection: the leaf case of the chain test and the new contract
test both fail with the full split they used to produce.
- Full `internal/unifiedresources` and `internal/api/resourceapi`
packages pass on pulse-dev.
2026-10-10 09:17:04 +01:00
rcourtman
21b496152c Remove the inert Assistant Protected guests setting (#2776)
## What and why

Settings > Pulse Intelligence > Assistant offered a **Protected guests**
list (`protected_guests`). The value was saved and pushed into the
Assistant tool executor, but the only code that read it was
`executeControlGuest`, which has no callers. The live mutation path,
`pulse_control type=resource` -> `executeControlResource` ->
`resolveControlTarget` -> `assistantTypedActionPlanner.PlanTypedAction`
-> `actionlifecycle.Service.Plan`, never consulted it. #2765 labelled
the field "legacy" and said it does not exclude saved plans; this
removes the setting instead of keeping a field that cannot do its job.

**Decision: remove, do not enforce.** The canonical way to keep Pulse
off a resource is its operator lock (**Never auto-remediate**, or a
Retired lifecycle): keyed by canonical resource id (a VMID or a name is
ambiguous across nodes and clusters), available for every platform, set
from the resource's own drawer, and enforced by the action lifecycle at
dispatch for every actor, approved plans included. A second,
string-keyed list that only the Assistant honours would extend a legacy
path next to a canonical one. Nothing in GitHub issues, discussions or
the demand ledger ever asked for it, and no user doc described it before
#2765.

The one real gap the lock had on the Assistant's path was planning:
`Plan` does not read operator state, so the Assistant could leave a plan
in Actions that can never run. `assistantTypedActionPlanner` now reads
the state through the tenant-scoped lifecycle store (the same read
Patrol's broker uses) and declines before `Plan`; `pulse_control`
returns an `ACTION_NOT_ALLOWED` result with `reason_code:
resource_remediation_locked` and how to clear it. A state that cannot be
read does not refuse planning, because dispatch re-checks.

## Proof it was inert (before)

- In-process, production planning chain (tool executor +
`assistantTypedActionPlanner` + real lifecycle and Proxmox executor,
only the node runner faked): a guest whose name and VMID were both in
the list was planned (`planned:true`, real action id). An
operator-locked guest was planned too.
- Live on a private non-mock stack (stub Proxmox node, stub
OpenAI-compatible provider emitting `pulse_control restart web-prod`,
`protected_guests: ["web-prod","101"]` saved): the call reached the
planner and was refused only by the runner availability gate; protection
was never consulted. (The typed action runner needs Linux systemd
containment, so planning success could not be reproduced live on macOS;
the in-process run covers it.)

## After

- Same live stack on this branch, with the old config (still carrying
`protected_guests`) loaded: `GET /api/settings/ai` omits the field,
Settings shows no field, Save sends no `protected_guests`.
- Locking `web-prod` through the real UI (guest drawer > Manage > Never
auto-remediate > Lock this resource > Save overrides) and repeating the
Assistant turn returns the lock refusal and leaves nothing in Actions.
Unlocked, the turn behaves as before.
- Negative control: with the planner check removed,
`TestAssistantDeclinesToPlanAgainstBlockedGuest` fails for both blocking
states.

## Compatibility

- A stored `protected_guests` still loads (tolerant decode) and is
dropped the next time the settings are written. `PUT
/api/settings/ai/update` ignores the key from older clients (verified by
test), and `GET` no longer returns it. No other repo reads it.
- The maintainer's saved-policy compatibility tests from #2765 keep
their real assertions (control level, entitlement, Patrol policy); only
the `ProtectedGuests` marker is gone. The legacy copy, pins and prose it
added are replaced: Settings points at the lock, docs/AI.md and
docs/AI_AUTONOMY.md say the list is gone and how to lock a resource,
contract clauses updated in ai-runtime, api-contracts, agent-lifecycle,
frontend-primitives and storage-recovery.
- `frontend-modern/browser-tests/assistant-control-compatibility.cjs` (a
manual harness for the maintainer's proof environment) is updated for
the removed field; it was not run here.

## What this does not fix (chipped separately)

- A lock is lost when its resource is manually linked into another
resource or re-keyed by an identity succession (`registry.go` fold,
`canonical_id_succession.go` `UPDATE OR IGNORE`).
- Saving a lock while a human-approved dispatch is being admitted can
race past the dispatch gate (`actionlifecycle.Service.Execute` re-checks
without the admission lock). The public copy says the lifecycle checks
the lock again before it runs an already-planned action; the contract
names the window.
- REST and Patrol planning still use the unchanged lifecycle planner;
the planning refusal is Assistant-only by design. The lock covers the
exact resource, not its host or descendants, and does not stop read-only
investigation.

## Verification

- Go: `internal/config`, `internal/ai/...`, targeted `internal/api`
(Assistant planning, AI settings handler, contract) and `go vet` pass
locally; new tests cover unlocked, Never auto-remediate, Retired,
non-blocking overrides, a non-default tenant, the exact response
envelope and no audit written on refusal.
- Frontend: tsc, eslint, copy and form-label lints,
Settings/utils/guardrail vitest pass; new AISettings test covers the
hint, read-only hiding, an old backend still echoing the list, and the
Save payload.
- Browser: private stack, desktop and 390px, Settings > Assistant and
the guest drawer Manage tab; receipt included.
- Three Sol review rounds; findings fixed (tenant store path,
overclaiming copy, retired-state remedy, missed browser harness pins,
missing receipt) or chipped.
2026-10-10 08:50:08 +01:00
rcourtman
70ed7488a4 Undo only the links that hold a reported source in report-merge
A source-filtered report-merge chose the links to undo by the sources
each fold's folded side took in, which spans that side's whole subtree.
Naming the source of a leaf in a chain (a Docker host linked into an
agent linked into a VM) also split the leaf's holder from the VM, and
where recorded links form a cycle a reported member stayed joined
through the link whose fold did not name it.

Folds now record what each side is on its own (HolderOwn, FoldedOwn),
read before the other side's sources are merged in, and
ReportedManualLinkFolds undoes the links that join a member carrying a
reported source to the part that stays or to another reported member.
A member hanging below a reported one goes with it and its link stays.
A report naming every source or none still undoes every link, so the
drawer's Split is unchanged; only API callers with a real sources
filter see a difference.
2026-10-10 08:10:56 +01:00
rcourtman
1d6d2bfcae Remove the inert Assistant Protected guests setting
Settings > Assistant offered a Protected guests list (protected_guests)
that was saved and pushed into the Assistant tool executor, but its only
reader was executeControlGuest, which nothing calls. pulse_control plans
through the shared action lifecycle and never consulted the list, so a
guest named in it (by VMID and by name) was planned like any other. The
"legacy" label added in #2765 states that limit; this removes the
setting instead of keeping a field that cannot do its job.

The canonical way to keep Pulse off a resource is its operator lock
(Never auto-remediate, or a Retired lifecycle). It is keyed by canonical
resource id, applies to every platform, and the action lifecycle refuses
dispatch for it even for approved plans. The one gap was planning: the
lifecycle plans without reading operator state, so the Assistant could
leave a plan in Actions that can never run. assistantTypedActionPlanner
now reads the state through the tenant-scoped lifecycle store (the same
read Patrol's broker uses) and declines before Plan, and pulse_control
reports the block with how to clear it. A state that cannot be read does
not refuse planning, because dispatch re-checks.

Removed: AIConfig.ProtectedGuests and its getter, the settings API
field, the executor field/setter/config, the chat service plumbing, the
Settings field and form state, and the legacy copy, pins and prose from
#2765. A stored value still loads (tolerant decode) and is dropped the
next time the settings are written; older PUT bodies that send the key
are ignored. The Settings panel points at the guest's Manage tab.
2026-10-10 07:46:45 +01:00
rcourtman
912d7ceb51 Judge connection freshness by the monitor's live poll cadence
Non-default organisations run their monitors against a detached copy of
the server config (#1619). A system-settings save reaches those monitors
only as runtime PBS and PMG polling overrides, so the copy that the
connections list reads through the org's config handlers kept the old
interval until that monitor was rebuilt. The active-to-stale cutoff is
3 x the polling interval, so raising PBS from 1m to 5m left a 3m cutoff
and Settings > Infrastructure badges read "stale" for part of every
cycle, while lowering it delayed the badge by the same factor.

Add Monitor.BasePollInterval, an override-aware reader for the clamped
PVE, PBS and PMG base cadence that never takes m.mu, and have the
connections input builder use it whenever a monitor is present. The
fixed-cadence branch of resourcePollIntervals reads the same accessor, so
resource freshness and connection freshness share one derivation.

The system settings GET is not affected: both production routes serve
SystemSettingsHandler, which reads the base config and persisted
settings; the configapi handler that reads the tenant copy is only a
fallback when that handler is absent.
2026-10-10 07:37:03 +01:00
pulse-triage[bot]
1927020ba2 Make Assistant controls describe governed action planning
Project interactive Assistant controls to Read-only and Ask first without migrating legacy stored preferences or relaxing entitlement, legacy command approval, scoped execution or Patrol policy. Preserve stored policy even when an older client echoes the projected mode on an unrelated save. Explain saved Actions plans and operator review in existing Settings, Chat and help.

Add saved-client and encrypted-config compatibility, authenticated plan-only access, active-stream and scope regression controls with parent comparisons. Record inspected final-byte desktop/phone browser proof and the affected subsystem contracts.

Change-source: pulse-maintainer
2026-10-10 00:28:43 +01:00
pulse-triage[bot]
01788459f1 Reduce HTTP metric route-label intermediates
Scan only the first five non-empty segments into a fixed stack buffer and build one owned label, preserving numeric, UUID-like, token, query and unknown-name behaviour. Pin baseline compatibility, bounded allocations, concurrency and actual middleware metric cardinality.

Contract-Neutral: Preserve all HTTP metric labels and recording contracts; reduce only temporary route-normalization allocations.
Change-source: pulse-maintainer
2026-10-09 20:44:07 +01:00
pulse-triage[bot]
65bf9e8260 Compose retained Core qualification candidate with current main
Preserve the exact prior Core history alongside current canonical Patrol resource-owner resolution and recovery cleanup. Runtime source retains the TrueNAS alert-policy repair and sequential repeated-name Docker assertions; current bytes require isolated qualification.

Change-source: pulse-maintainer
2026-10-09 08:10:32 +01:00
pulse-triage[bot]
fcfeba39e0 Integrate batch-start upstream main
Merge exact upstream 7f466fc183 without re-parenting its reviewed history. Retain both independent contract sections in the two documentation conflicts; no frontend resolution or runtime correction.

Change-source: pulse-maintainer
2026-10-09 08:04:32 +01:00
rcourtman
19d016d7df fix(patrol): resolve disk alerts through canonical resource owners
Host filesystem alerts identify a disk child that Patrol does not collect as
a separate resource. Bind an exact collected alert to its current canonical
owner through the shared inventory contract, including linked agents, and
retain its filesystem, threshold and breach evidence in the scoped prompt.

Keep missing owners, ambiguous source identities and uncollected child
subjects fail-closed. Add evaluator-to-handler, repeated scope resolution
and browser admission coverage.
2026-10-08 17:22:29 +01:00
pulse-triage[bot]
d525ef6583 Resolve TrueNAS Patrol disk heat through its alert policy
Reconcile the absent runtime portion of PR2693 aaf5398480 on current assigned source. TrueNAS disk heat follows its disk override, TrueNAS-wide default and inherited per-type policy rather than the system synthetic agent ID. Preserve agent-host overrides, Off, clear thresholds, alert switches, retained-reading limits and canonical identity. Include discriminating resolver, adapter, Patrol and Assistant tests; leave the frontend stack to Web.

Change-source: pulse-maintainer
2026-10-08 11:03:46 +01:00
pulse-triage[bot]
e2967173d8 Preserve reviewed monitoring work with current upstream freshness thresholds
Additively incorporate the exact main repair that landed during this publication turn. Preserve every starting reviewed commit and the deferred browser qualification boundary.

Change-source: pulse-maintainer
2026-10-08 09:27:07 +01:00
rcourtman
415c09dafc Judge resources API freshness by the monitor's thresholds
The resources API rebuilds its registry from the monitor's unified
seed, but built it with NewRegistry and plain ingests, so its stale
pass used the registry defaults while the monitor judges each source
by its configured polling cadence. A Proxmox node polled every two
minutes read stale, with warning status, in /api/resources ninety
seconds after its poll while the websocket called it online.

Presentation coalescing had the same gap in both views. When it merges
an agent row the registry kept apart into its Proxmox node by hostname,
it picked each reading's source by the default thresholds, so the row
showed a silent agent's readings over a poll the registry calls
current.

The seed now carries the thresholds its registry generation was judged
by. The monitor adapter records them per generation: thresholds set
since the last rebuild wait for the rebuild that applies them, and the
read-state overlays and live supplemental refreshes of a generation are
judged by its thresholds, since re-judging a listing cannot clear a
stale verdict it already carries. The monitor lists a generation with
its thresholds from one registry pointer, and a view built from mock
fixtures or a bare snapshot reports none (the defaults it was judged
by). The monitor hands seed, freshness and thresholds over from one
view, per tenant too. The resources API builds
its registry with them (NewRegistryWithStaleThresholds: ingests and
stale passes that pass none use them) and keys its cache on its own
copy. The coalesce judges metric freshness with metricSourceStale, the
rule the stale pass and the merge already share, and both the
broadcast and ListForPresentation pass their view's thresholds. The
broadcast coalesce also honours the operator's merge exclusions, so the
adapter's CoalesceForPresentation takes the listing's thresholds next
to them.

Patrol's scoped runtime state still rebuilds registries with the
defaults.
2026-10-08 08:53:19 +01:00
pulse-triage[bot]
95fca3477a Merge batch-start upstream summary chart route removal
Preserve the exact published history while reconciling this bounded candidate batch. Change-source: pulse-maintainer

Change-source: pulse-maintainer
2026-10-08 08:42:36 +01:00
pulse-triage[bot]
b03965a0d2 Merge branch 'main' into refactor/drop-summary-chart-routes 2026-10-08 07:45:44 +01:00
pulse-triage[bot]
983547f8de Merge reviewed saved PMG collection scope and readback repair
Retain both exact candidate commits and their focused normal/race evidence. Missing readings preserve alert state; persisted opt-outs remain explicit on settings readback.

Change-source: pulse-maintainer
2026-10-08 07:18:46 +01:00
pulse-triage[bot]
0ae6e32b7d Merge batch-start upstream saved-host link continuity
Preserve the exact upstream commits already present at coordination start; later upstream reconciliation remains with the publication gate.

Change-source: pulse-maintainer
2026-10-08 07:18:44 +01:00
pulse-triage[bot]
485299acea Keep PMG opt-outs explicit in settings readback
The existing edit form defaults omitted mail, queue and quarantine flags to on. Serialize false collection options explicitly and test the real node GET payload so reopening an all-off or partial scope cannot silently re-enable reads on a later save.

Change-source: pulse-maintainer
2026-10-08 07:00:10 +01:00
pulse-triage[bot]
64364d97c8 Honour saved PMG collection scope without inventing recovery
Gate mail, queue and quarantine reads at the owning poller. Preserve legacy mail defaults while persisting explicit all-off scope, keep missing readings out of alert recovery and reject absent PMG object data. Partial queue observations may prove the highest configured severity but cannot resolve or downgrade alerts. Retain version connectivity separately from downstream poll failure and cover scope, persistence, pause, in-flight and adverse-read boundaries.

Change-source: pulse-maintainer
2026-10-08 06:54:46 +01:00
pulse-triage[bot]
a9a7264779 Merge batch-start upstream Patrol reference resolution
Change-source: pulse-maintainer
2026-10-08 06:49:28 +01:00
pulse-triage[bot]
6d005e198a Merge batch-start upstream reference repair and Patrol receipt
Incorporate upstream frontier 30ab8fa31f present at batch start. Preserve canonical reviewed history and exact upstream identities without changing frontend source.

Change-source: pulse-maintainer
2026-10-08 06:36:50 +01:00
rcourtman
19d8b4f81a Resolve saved hosts an operator link joins to the link's primary
After a restart, an agent an operator linked into a live resource, such
as an agent inside a vSphere VM, exists only through saved-host
continuity until it reports again. Three consumers then disagreed about
what a reference to it meant. The read state kept the saved agent as its
own offline row and resolved references to it there. The resources API,
which seeds a registry from that listing and re-applies the links,
folded it into the VM and merged its stale telemetry. Alert intent
resolved through the published registry, where the agent is absent, so
its agent:<host ID> alerts kept their literal reference. Maintenance or
NeverAutoRemediate set on the VM reached neither the agent's alerts nor
its Patrol findings in that window, while the API said it applied.

An operator link names one identity; telemetry separation is the only
reason the saved row stays apart. Link application now holds a saved
row beside the link's primary instead of merging it, in every registry.
A reference that resolves to the saved row (its canonical ID,
agent:<host ID>, its machine ID or an alias it shares with the primary)
resolves to the primary, as a folded row's references do, while each
row keeps its own telemetry. An in-memory marker on rows continuity
introduced rides clones, so the resources API's registry holds them the
same way. A saved primary leaves a live member its own identity.

Alert intent now resolves references and ancestors through the published
registry with saved hosts overlaid, the read state Patrol resolves
through. That also lets intent set on an unlinked saved host reach its
offline alert. The resolver runs under the alert manager's lock once
per metric check, so the overlay is kept per published registry
generation, publication builds it before alerts are evaluated, and a
build that overlaps a mock-mode switch is discarded.
2026-10-08 06:27:50 +01:00
rcourtman
b60f441e22 Resolve Patrol finding references before reading operator state
Patrol's finding operator-state provider read the store under the
finding's exact reference first and resolved it only on a miss. Once an
operator link folds an agent into a VM, a finding kept under the agent's
ID still found the agent's own row, even a default-valued one, and missed
the maintenance window or monitoring mode the operator then set on the
merged VM. The resources API and alert intent resolve first, so Patrol
disagreed with both.

The provider now resolves every reference through the organization
monitor's current read state (the published registry with saved hosts
overlaid, or the mock estate), which is the listing the resources API
seeds from, and reads only an unresolved reference as given. The old
miss path built a resources-API registry, which clones the unified
listing, for every finding without a row; the read state answers from a
registry it keeps.

One window still differs: a saved agent linked into a live VM that has
not reported since a restart stays its own row in the read state, so its
findings read the agent's own state there, as alert intent does.
2026-10-08 06:25:45 +01:00
pulse-triage[bot]
354831d6ab Merge reviewed audit filter validation repair
Preserve the exact reviewed audit export and summary validation commit and its source-tested scope controls.

Change-source: pulse-maintainer
2026-10-08 04:33:06 +01:00
pulse-triage[bot]
9316d9cc60 Preserve reviewed maintenance with the latest published source cleanup
Additively incorporate exact observed upstream a9f23501eb following successful bounded refresh 7a6fff3c87105d65e8e5cb5b45e82d27bffdedd05ff2c846e086aa27f2daee21. Retain starting reviewed tip d6a0244ede and both earlier full-SHA compositions. This batch remains deferred for its outstanding canonical, browser and security evidence; no source validation or release readiness is inferred.

Change-source: pulse-maintainer
2026-10-08 03:54:25 +01:00
rcourtman
7949036657 Merge origin/main into fix/link-fold-references
PR 2739 added Resource.linkFolds, a record of every link folded into a
resource that rides in-memory clones, which is the same fold set this
branch carried as Resource.linkFoldedIDs. Keep one record: drop
linkFoldedIDs and index folded IDs from linkFolds when a link applies
and when resource seeding copies the record in.

Main's unlink test treated a lookup by the folded agent's ID as proof
that the agent was still listed. That lookup now answers with the VM
holding it, as lookups by source IDs and canonical aliases already do,
so the test checks which row answered and pins the VM answer.
2026-10-08 03:30:51 +01:00
rcourtman
31fcc4f4d6 Split operator-linked resources when a merge is reported (#2739)
Stacked on #2725 (Split a manually linked pair when the API unlinks it).
Until that merges this PR carries its commit too; only the last commit
is new here.

## Problem

`POST /api/resources/{id}/report-merge` (the drawer's "Split merged
resource" dialog) excluded only the candidate IDs that
`ResourceRegistry.SourceTargets` derives with
`sourceSpecificID(mergedResource.Type, source, sourceID)`. For a source
an operator link folded in, that candidate names neither side of the
link:

- an agent linked into a VM gets a `vm-` candidate;
- an agent linked with a node or a Docker host gets a source-specific
candidate, while the folded side's canonical ID derives from its machine
ID.

No `resource_links` row matched, so even with #2725's
one-decision-per-pair store rule the link survived, the pair stayed
merged on REST, `/api/state` and the websocket, and the API answered 200
"Merge reported" while the dialog toasted "Resource split applied". Two
linked agents share their only source, so the API refused them as
"Resource is not merged".

Identity merges were already handled: `findMatch` checks exactly the
candidate `SourceTargets` reports, and an agent/Docker pair merged by
machine identity stays apart through three monitor rebuilds after
report-merge. That is now pinned by a test.

## Fix

- `applyManualLinks` records each link it applies on the merged resource
(`recordManualLinkFold`, unexported `Resource.linkFolds`): the link
row's own pair plus the sources the folded side brought, carrying the
folded side's earlier folds so each link along a chain keeps its pair.
- The record rides in-memory clones. The resources API seeds its
registry from the monitor's already-linked listing and never holds the
folded row, so this is the only place it can learn the pair.
- `HandleReportMerge` excludes the pair of every link whose folded side
brought a reported source (`ResourceRegistry.ManualLinkFolds`),
alongside the existing identity-match exclusions, deduplicated in either
order. #2725's `AddExclusion` then deletes the link row, so the pair
splits from the monitor's next rebuild, as with unlink. An applied link
also counts as a merge, so two linked agents can be reported.
- A pair is recorded once. Record ingest can recreate a folded side
whose source mapping points at a holder of another type, then fold it
again.
- A link joins only the pair its row names. Canonical-ID succession
re-keys link endpoints with `UPDATE OR IGNORE` but moves `primary_id`
unconditionally. A row whose re-key collided with the successor's own
row therefore kept the retired endpoint and took the successor as its
primary, and `applyManualLinks` merged the successor through it. No
unlink or report-merge of the merged pair removed that row. A primary
naming neither side now falls back to the row's first side, which leaves
such a row inert.

The drawer sends every merged source. Source categories are not
attributed to individual contributors, so naming one that a folded side
carried undoes that link. A source that arrived along a chain undoes
every link on its way to the merged resource.

## Verification

- `TestResourceReportMergeSplitsOperatorLinkedPair`: link and
report-merge through the API handlers against a `MonitorAdapter` on the
same SQLite store, rebuilt three times per step. Cases cover VM/agent,
node/agent and agent/Docker pairs linked from either side, plus two
linked agents. With #2725's handler, 6 of the 7 cases fail: five with
"report-merge left 1 monitor resources", and the agent pair with a 400.
The exception is a node linked from its agent, because the node's
source-specific candidate happens to be its own ID.
- `TestResourceReportMergeSplitsPairBehindASuccessionShadowedRow`,
`TestResourceReportMergeSourceFilterSelectsLinks`,
`TestResourceReportMergeSplitsIdentityMergedPair`,
`TestContract_ResourceReportMergeReplacesOperatorLink` (response shape
plus link removal), `TestManualLinkFoldsNameEachLinkPairAlongAChain`
(monitor registry and a registry seeded from its listing),
`TestManualLinkFoldsRecordEachPairOnceAcrossRecordIngests`,
`TestManualLinkFoldRepeatedPairKeepsEarlierSources`,
`TestCloneResource_CarriesLinkFolds`, and the
`TestResourceAPIReportMergeExcludesRegistryLinkFolds` guardrail.
- Negative controls, each failing at the expected assertion: the handler
from #2725, the old not-merged gate, the primary honoured outside its
row, folds appended without dedupe, a repeated pair keeping only its
later sources, `applyManualLinks` without `recordManualLinkFold`, and a
clone that shares the fold slice.
- Full `./internal/unifiedresources/...`,
`./internal/api/resourceapi/...`, `./internal/truenas/...` and
`./internal/monitoring/...` pass.
2026-10-08 03:19:09 +01:00
pulse-triage[bot]
bfca5b34b8 Preserve reviewed maintenance with current upstream monitoring and SAML repairs
Additively incorporate exact upstream main 533027ee06 without rewriting accepted maintenance. Resolve the storage-recovery contract insertion by retaining both the reviewed silent-source History fence and upstream SAML/method constraints. No runtime conflict resolution is introduced; final-content evidence and exact-head checks remain required before publication.

Change-source: pulse-maintainer
2026-10-08 03:06:27 +01:00
rcourtman
295edef4d5 Bind SAML logins to the browser that started them (#2729)
## Why

With `allowIdpInitiated` off, the default, every SAML login failed.
`SAMLService.ProcessResponse` passed crewjam/saml an empty list of
request IDs, and crewjam refuses any Response whose `InResponseTo` is
not in that list, so both SP-initiated and unsolicited Responses ended
in "Authentication failed". Only providers with IdP-initiated logins
enabled, which skips the check, could sign in.

## What changes

- `/api/saml/{id}/login` records each AuthnRequest ID, on the provider's
service, with the login's `returnTo` and the hash of a random token it
sets as the `HttpOnly`, `SameSite=Lax` cookie `pulse_saml_login`
(`__Host-pulse_saml_login` over HTTPS). A browser that already holds a
token keeps it, so logins started one after another in several tabs all
stay valid. Records last ten minutes, 1,024 per provider, oldest
evicted.
- The IdP posts its Response cross-site, and browsers withhold
`SameSite=Lax` cookies from cross-site POSTs. The ACS answers a
cookieless POST with a small page that re-posts the same fields once
from Pulse's own origin (no form action, so path prefixes survive; CSP
nonce on the script; a no-JS Continue button; a marker field stops a
second repost).
- `ProcessResponse` reads the answered request ID from the canonical
content goxmldsig verified for the signature covering the assertion
crewjam returns: the signed Response (or the Response in a signed
ArtifactResponse), otherwise that assertion's own
`SubjectConfirmationData`. It spends the record only when it is bound to
the presenting browser, and the login returns to the recorded `returnTo`
rather than the posted `RelayState`. A Response for another browser
leaves that browser's record intact.
- The signature verifier refuses signed content carrying a prefixed
attribute or namespace declaration named like an un-namespaced attribute
crewjam reads. encoding/xml fills such a field from any attribute with
that local name, and exclusive canonicalization leaves an unused
declaration out of the signed form. On the base commit, appending
`xmlns:IssueInstant` and `xmlns:NotOnOrAfter` to a two-hour-old signed
Response got it accepted, so with `allowIdpInitiated` on a captured
login could be replayed indefinitely.
- RelayState is now URL-escaped into the redirect, so a `returnTo` with
its own query string reaches the IdP whole.
- With `allowIdpInitiated` on, behaviour is otherwise unchanged: no
cookie or repost needed, posted `RelayState` honoured.
- The SLO LogoutRequest store from #2713 is generalised into a shared
record store; its `consume` semantics are unchanged.

Stacked on #2714 (on #2713, on #2707). Those three conflict with main in
`storage-recovery.md`, where their boundary notes and main's land at the
same anchor, so none can merge on its own. This branch carries a merge
of main that keeps both sets of notes; landing it lands the stack.

## Verification

- New tests in `internal/api/saml_handlers_more_test.go`,
`saml_service_test.go` and `audit_handlers_test.go`: default-settings
login through the repost, multiple tabs, refusal of another browser's,
unknown, unsolicited and replayed Responses (the refused browser's own
login still completes afterwards), the `xmlns:InResponseTo` spoof with
the Response signed and with only the Assertion signed, a
confirmation-less signed assertion spliced ahead of another browser's
assertion, assertion-only signed success, stale IdP-initiated Responses
with spoofed ages, repost escaping and CSP nonce, and the audit event
for a binding refusal.
`TestContract_SAMLManualIDPCertificateVerifiesIdPSignatures` now runs at
default settings instead of enabling IdP-initiated logins.
- Negative controls by `-overlay`: with the attribute refusal disabled
the stale-Response replay is accepted again; with the refusal disabled
and the binding read from crewjam's parsed fields the
`xmlns:InResponseTo` spoof logs in; the round-one binding code accepted
the spliced-assertion case as the other user.
- A real Chromium run against a test IdP on `127.0.0.1` and the SP
handlers on `localhost`, behind `SecurityHeadersWithConfig` in
production CSP mode: the IdP's POST arrived `Sec-Fetch-Site: cross-site`
without the login cookie, the repost arrived `same-origin` with it, and
the login landed signed in at
`/alerts?range=7d&saml=success&tab=history`.

## Known limits

- Records live in memory: a restart, a provider re-initialization, or a
login started on a host that does not share cookies with the configured
public URL leaves the Response unmatched, and the user signs in again.
- Two logins started at the same moment in a browser that holds no token
yet each mint one; the last cookie wins and the other login fails.
- As with OIDC login state, a sustained flood of unauthenticated login
starts can evict pending records.
- On plain HTTP, or HTTPS that Pulse does not recognise behind a proxy,
the cookie has no `__Host-` prefix, so a sibling subdomain could plant
one, the same exposure the session cookie has there.
2026-10-08 02:45:20 +01:00
pulse-triage[bot]
582113ccd0 Reject malformed audit export and summary time filters
Share existing list time validation across audit reads so malformed, empty or non-increasing supplied bounds cannot silently widen an investigation. Preserve absent filters, access and tenant gates, export formats and existing pagination boundaries; reject invalid export success booleans before reading events. Pin actual handlers and exporter with fake persistent loggers, including no-query rejection and tenant isolation, and update both copies of the audit guide.

Change-source: pulse-maintainer
2026-10-08 02:44:07 +01:00