mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-03 18:43:38 +01:00
I added Schema v26 content-free Infrastructure Map topology read telemetry for external live GET /api/agent/topology requests (total read days, CLI days, MCP days, anonymized days, and an explicit availability flag) alongside hardened opt-out zero-write boundaries, credential-binding checks, and read-only SQLite/config guards. Key changes: - Added a dedicated root-scoped daily tally store (infrastructure_map_topology_tally.json) with strict schema validation, fail-closed degraded sidecar accounting, and strict zero-write guarantees when telemetry is disabled by settings or PULSE_TELEMETRY=false. - Added X-Pulse-Agent-Surface attribution for pulse-cli and MCP clients while filtering out first-party browser traffic, mock-mode snapshots, and unverified monitor states. - Updated Settings payload preview, localization copy, shipped PRIVACY.md disclosure, integration specs, and schema parity tooling for Schema v26. - Hardened host/agent token hash binding, self-uninstall live authority and durable hash-scoped tombstones, Patrol investigation replay-floor provenance, bounded non-blocking regular-file config reads, and cold read-only legacy SQLite history queries.
53 lines
1.6 KiB
Go
53 lines
1.6 KiB
Go
package api
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/rcourtman/pulse-go-rewrite/internal/telemetry"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
// ApplyLicensedFeatureTelemetrySnapshot adds router-owned, content-free
|
|
// adoption counts for licensed features whose state lives behind the router
|
|
// rather than in persisted config files.
|
|
//
|
|
// Counts only. Role names, permission sets, and usernames stay on the install;
|
|
// only "how many" leaves it. The `now` parameter is retained for symmetry with
|
|
// the other router telemetry boundaries.
|
|
func (r *Router) ApplyLicensedFeatureTelemetrySnapshot(s *telemetry.Snapshot, now time.Time) {
|
|
if r == nil || s == nil {
|
|
return
|
|
}
|
|
|
|
orgIDs, err := r.pulseIntelligenceTelemetryOrgIDs()
|
|
if err != nil {
|
|
return
|
|
}
|
|
for _, orgID := range orgIDs {
|
|
applyRBACAdoption(s, r, orgID)
|
|
}
|
|
}
|
|
|
|
// applyRBACAdoption counts operator-authored roles and role assignments.
|
|
// Built-in roles ship with every install and are excluded so the count means
|
|
// "this operator configured RBAC", not "this install booted".
|
|
func applyRBACAdoption(s *telemetry.Snapshot, r *Router, orgID string) {
|
|
manager, ok := r.rbacProvider.PeekManager(orgID)
|
|
if !ok || manager == nil {
|
|
return
|
|
}
|
|
if err := rbacMigrationFailure(manager); err != nil {
|
|
// A degraded store reports a partial picture; counting it would
|
|
// understate adoption without any way to tell from the aggregate.
|
|
log.Debug().Err(err).Str("org_id", orgID).Msg("Skipping RBAC telemetry for degraded store")
|
|
return
|
|
}
|
|
|
|
for _, role := range manager.GetRoles() {
|
|
if !role.IsBuiltIn {
|
|
s.RBACCustomRoles++
|
|
}
|
|
}
|
|
s.RBACUserAssignments += len(manager.GetUserAssignments())
|
|
}
|