Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Address review: dashboard switch for accounts that cannot read config.json

Claude2a4b7c4b9779
diff --git a/CLAUDE.md b/CLAUDE.md
index fd167118..a8423d61 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -73,7 +73,7 @@ Supported runtime surfaces today:
- Beacon Cloud forwarding, the one Beacon-hosted network channel for endpoint telemetry: user-mode `beacon endpoint connect` authorizes device enrollment with the signed-in CLI account; system mode uses browser PKCE at `/cli/enroll`. Both store only the per-device key in `<BaseDir>/asymptote/vector-secrets.json` (0600, 0700 dir), render the selected privacy mode into `vector.toml` (re-rendered in place by install, repair and package upgrades, see above), validate it, and run Vector as `com.beacon.endpoint.asymptote-forwarder` / `beacon-asymptote-forwarder.service` through `service.ForwarderManager` (refused in supervised mode). `enrollment.json` and `config.json`'s `managed_ingest` block carry only non-secret identity and privacy mode; `beacon endpoint status` reports forwarder state and a live credential check (`GET /v1/ingest/health`, 3 s timeout); `disconnect` and `uninstall` remove the forwarder and credentials but never revoke server-side.
- Asymptote Observe TypeScript SDK instrumentation for cloud applications, starting from OpenTelemetry/OpenLLMetry patterns and `observe()` wrappers.
- Elasticsearch/Filebeat content pack generation for forwarding local Beacon JSONL into customer-managed Elastic deployments or the bundled loopback-only development stack.
-- A local-only dashboard served by `beacon endpoint dashboard`, bound to loopback by default and backed by the runtime JSONL log (docs in `docs/cli/dashboard.mdx#access-control`). Loopback binding and `RequireLoopbackHost` keep other machines and DNS-rebinding pages out but not other local accounts, so every run (and `beacon lenses preview`) makes a per-launch secret (`dashboard.NewToken`, 256 bits, kept in memory and printed only inside `LaunchURL`'s `?token=`, never written to a file, log or JSON) and `ListenAndServe` refuses to start without `Options.Token`. `RequireToken` (`dashboard/access.go`) accepts the token once per browser, sets an HttpOnly, SameSite=Strict, Path=/ cookie named for the port (`CookieName`) and 303-redirects without the token; every other request needs the cookie (constant-time compare) or gets 401. Lens frames and `/api/lens-data` ride the cookie as same-site requests; the e2e server takes its secret from `BEACON_E2E_DASHBOARD_TOKEN` and the Playwright config seeds the cookie (`tests/access.spec.ts` covers the launch URL). Cookies are shared across ports of `127.0.0.1`, so never describe the secret as more than keeping out accounts that do not have it. The administrator switch is the system `config.json` `dashboard` (`enabled`, the default when empty, or `disabled`; `install|repair --system --dashboard`, `BEACON_DASHBOARD` in the three install scripts, carried by `buildConfig`, refused in user mode): when disabled, `refuseDisabledDashboard` (`cmd/endpoint_dashboard_access.go`, via `endpointconfig.SystemDashboardDisabled`) stops the dashboard and lens preview for every account, a system config that exists but cannot be read or parsed refuses too, and status reports it as `dashboard`.
+- A local-only dashboard served by `beacon endpoint dashboard`, bound to loopback by default and backed by the runtime JSONL log (docs in `docs/cli/dashboard.mdx#access-control`). Loopback binding and `RequireLoopbackHost` keep other machines and DNS-rebinding pages out but not other local accounts, so every run (and `beacon lenses preview`) makes a per-launch secret (`dashboard.NewToken`, 256 bits, kept in memory and printed only inside `LaunchURL`'s `?token=`, never written to a file, log or JSON) and `ListenAndServe` refuses to start without `Options.Token`. `RequireToken` (`dashboard/access.go`) accepts the token once per browser, sets an HttpOnly, SameSite=Strict, Path=/ cookie named for the port (`CookieName`) and 303-redirects without the token; every other request needs the cookie (constant-time compare) or gets 401. Lens frames and `/api/lens-data` ride the cookie as same-site requests; the e2e server takes its secret from `BEACON_E2E_DASHBOARD_TOKEN` and the Playwright config seeds the cookie (`tests/access.spec.ts` covers the launch URL). Cookies are shared across ports of `127.0.0.1`, so never describe the secret as more than keeping out accounts that do not have it. The administrator switch is the system `config.json` `dashboard` (`enabled`, the default when empty, or `disabled`; `install|repair --system --dashboard`, `BEACON_DASHBOARD` in the three install scripts, carried by `buildConfig`, refused in user mode): when disabled, `refuseDisabledDashboard` (`cmd/endpoint_dashboard_access.go`, via `endpointconfig.SystemDashboardDisabled`) stops the dashboard and lens preview for every account, and status reports it as `dashboard`. Any value but empty or `enabled` reads as disabled (`Config.DashboardMode`), and `buildConfig` carries such a value as `disabled` (`carriedDashboard`) so preflight never fails a repair over it. A system config holding a HEC token is root-only, so `endpointconfig.Save` also keeps a world-readable `dashboard-disabled` marker beside the system config while the switch is off (`syncDashboardMarker`; uninstall removes it); `DashboardDisabledAt` reads the config when it can and the marker only when reading the config is refused for permission, a config that does not parse refuses, and `buildConfig` keeps the switch off from the marker (`systemDashboardMarked`) when the config does not load.
- Token usage and runtime-reported cost capture across spans, logs, and metric datapoints, normalized into `gen_ai.usage`, with attribution rollups served by the dashboard token view (`/api/tokens`) and the `beacon token-usage` report command for local and CI logs. Every report row carries three costs (`cli/beacon/internal/tokens/cost.go`): `cost_usd` (runtime-reported, unchanged), `estimated_cost_usd` (list price of every priced token, from `internal/pricing`, computed after dedup and cumulative resolution) and `effective_cost_usd` with `cost_source` (per endpoint/harness/session scope, reported cost wins wholesale when the scope has any; otherwise the estimate; session-less events per event), plus `unpriced_events`/`unpriced_tokens` and a report-level `pricing` block (catalog provenance, per-model key, match, base rates, bands applied, fallbacks, unpriced models). Long-context bands apply only to events `requestScoped` classifies as one model request; it defaults to aggregate, so a new capture path is priced at base rates until it is added there with a test. Lens data (`LensDataV1`) carries no estimate.
- Local threat detection via `beacon scan`, which runs the open Threat Rules format (`spec/threat-rules`; CEL match conditions over the endpoint event schema, with embedded conformance fixtures) over the runtime JSONL. The engine (`pkg/asymptoteobserve/threatrules`) ships in the binary; the rule corpus is external data loaded from a local store (`~/.beacon/endpoint/rules`) managed by `beacon rules`, so the corpus can grow without enlarging the binary. `scan` is read-only and offline; only the explicit, user-initiated `beacon rules pull <url>` reaches the network, over `https://` only (plain http just for loopback, no redirect off https), size-capped, and verified first when `--sha256` is given. A small frozen baseline is embedded so `scan` works before any rules are installed, and it stays active alongside the store: a store rule replaces a baseline rule only by id (`rulestore.LoadActiveSkipping`), so installing one rule never silently switches the baseline off; only `--rules <dir>` runs a directory alone.
- Session handoff via `beacon handoff list|export|resume` (`cli/beacon/internal/handoff`, `cli/beacon/cmd/handoff*.go`; docs in `docs/cli/handoff.mdx` and `docs/concepts/session-handoff.mdx`). Every runtime is one entry in the registry in `cli/beacon/internal/handoff/runtimes.go`: its session source, the names it answers to, and the commands that reopen it or start it from a brief; `TestRegistryIsConsistent` checks the entries. Handoff reads the session stores of Claude Code, Codex CLI, OpenCode, Cline, Pi, Prime Agent, Factory Droid, GitHub Copilot CLI, Hermes Agent, DeepSeek Harness, fx, Grok Build, OpenClaw Gateway and Cursor read-only and never touches the network. Oh My Pi, Gemini CLI, Qwen Code, Kiro, Antigravity CLI, Devin CLI, Muse Code, OpenHands and goose have no store Beacon reads: their sessions come from the runtime log, and they take a brief as the target of `--agent`. `resume` reopens a session natively with its runtime's own command when it can, and otherwise writes a brief to `~/.beacon/endpoint/handoffs` (0700/0600) and starts a new session pointed at it. DeepSeek Harness cannot be started, and Hermes Agent and fx only reopen their own sessions, so their sessions continue in another runtime. fx, Grok Build and Cursor find a session by the directory they run in, so they are reopened natively only in the session's own directory. The brief is passed by absolute path, never inlined on a command line. By default the runtime runs in the calling terminal; `--launch auto|new-terminal|tmux` (`internal/handoff/detached.go`) instead writes a one-time `launch-<id>.json` specification (0600, expires after five minutes) beside the briefs, opens a terminal surface (cmux or Terminal.app, Windows Terminal or PowerShell, a Linux terminal emulator, or a detached tmux session) running the hidden `beacon handoff _launch --spec`, and waits up to 15 s for it to confirm the runtime started, removing the specification on a timeout so a late terminal starts nothing (the trampoline claims it by an atomic rename, so a timeout after the claim reports that the runtime may still start rather than cancelled, and the status is renamed into place so the caller never reads it half-written). Content is never put on the terminal's command line, and only the store-locating path variables in `carriedEnvNames`, never credentials, are carried into the specification. Every launch keeps the runtime's approvals on: Beacon never passes a flag that turns them off, names the approval mode that asks where a CLI takes one (Cline always gets `--auto-approve false`, because Cline defaults to approving every tool call), and removes or overrides environment switches that would approve everything (`COPILOT_ALLOW_ALL`, `COPILOT_PLAN_THEN_AUTOPILOT`, `HERMES_YOLO_MODE`, `GOOSE_MODE`); `--print` shows them under `env`. Briefs run every event through `SanitizeEvent`, and quoted content goes in fences longer than any backtick run it contains, with inline fields reduced to one line, so quoted content cannot forge brief structure. A new session's first prompt ends with the `[beacon-handoff from=<harness> session=<id>]` marker (`pkg/asymptoteobserve/handoff.go`). The hook and plugin prompt paths and the session-store mappers record a `session.handoff` event with `handoff.{source_harness,source_session_id}` when they see it; that is an observed claim, not a verified identity.
diff --git a/cli/beacon/internal/endpoint/config/config.go b/cli/beacon/internal/endpoint/config/config.go
index 2f634bc2..3f0ff14d 100644
--- a/cli/beacon/internal/endpoint/config/config.go
+++ b/cli/beacon/internal/endpoint/config/config.go
@@ -145,29 +145,57 @@ func ParseDashboardMode(value string) (string, error) {
}
}
-// DashboardMode is the setting this config records, with empty read as enabled.
+// DashboardMode is the setting this config records. Empty and "enabled" read as enabled; any other
+// value, including one written by hand that --dashboard would refuse ("off", "no"), reads as
+// disabled, so a mistyped switch fails closed rather than leaving the dashboard on.
func (c Config) DashboardMode() string {
- if strings.EqualFold(strings.TrimSpace(c.Dashboard), DashboardDisabled) {
+ switch strings.ToLower(strings.TrimSpace(c.Dashboard)) {
+ case "", DashboardEnabled:
+ return DashboardEnabled
+ default:
return DashboardDisabled
}
- return DashboardEnabled
+}
+
+// dashboardDisabledMarker is the file, beside the system config, that records a disabled dashboard
+// for the accounts that cannot read config.json itself: Save makes config.json readable only by root
+// (SYSTEM and Administrators on Windows) once it holds a Splunk or Falcon HEC token, and the switch
+// has to reach exactly those ordinary accounts. It holds no secret, so it is readable by everyone,
+// and it lives in the root-owned system config directory, so no one else can create or remove it.
+const dashboardDisabledMarker = "dashboard-disabled"
+
+// DashboardMarkerPath is the disabled-dashboard marker that goes with the config file at configPath.
+func DashboardMarkerPath(configPath string) string {
+ return filepath.Join(filepath.Dir(configPath), dashboardDisabledMarker)
}
// SystemDashboardDisabled reports whether the system config turns the local dashboard off for
// everyone on this machine. A machine without a system config (a user-mode endpoint) has it on.
-// The system config is readable by every account, which already reads it to find the system log.
func SystemDashboardDisabled() (bool, error) {
return DashboardDisabledAt(SystemConfigPath())
}
-// DashboardDisabledAt is SystemDashboardDisabled for the config file at path. Only a missing file
-// means enabled: a config that exists but cannot be read or parsed is an error, so a broken or
-// unreadable file never silently turns the administrator's switch back on.
+// DashboardDisabledAt is SystemDashboardDisabled for the config file at path. The config decides
+// when it can be read. When it exists but this account may not read it (it holds a HEC token, so
+// it is root-only), the marker Save keeps beside it decides instead. A missing config means enabled;
+// one that does not parse, or a marker whose presence cannot be checked, is an error, so a broken
+// file never silently turns the administrator's switch back on.
func DashboardDisabledAt(path string) (bool, error) {
data, err := os.ReadFile(path)
if errors.Is(err, os.ErrNotExist) {
return false, nil
}
+ if errors.Is(err, os.ErrPermission) {
+ _, markerErr := os.Stat(DashboardMarkerPath(path))
+ switch {
+ case markerErr == nil:
+ return true, nil
+ case errors.Is(markerErr, os.ErrNotExist):
+ return false, nil
+ default:
+ return false, fmt.Errorf("check %s: %w", DashboardMarkerPath(path), markerErr)
+ }
+ }
if err != nil {
return false, err
}
@@ -180,6 +208,19 @@ func DashboardDisabledAt(path string) (bool, error) {
return Config{Dashboard: cfg.Dashboard}.DashboardMode() == DashboardDisabled, nil
}
+// syncDashboardMarker writes the disabled-dashboard marker beside a system config that disables the
+// dashboard, and removes it beside one that does not.
+func syncDashboardMarker(configPath string, disabled bool) error {
+ marker := DashboardMarkerPath(configPath)
+ if disabled {
+ return atomicfile.Write(marker, []byte("The administrator disabled the local Beacon dashboard on this machine (config.json \"dashboard\").\n"), 0644)
+ }
+ if err := os.Remove(marker); err != nil && !errors.Is(err, os.ErrNotExist) {
+ return err
+ }
+ return nil
+}
+
// RestrictedLogAccess reports whether this endpoint's system log is in the restricted access mode:
// written only by the privileged collector, readable by root (SYSTEM and Administrators on
// Windows) and the beacon-log group, with hooks sending their events over the local ingest socket
@@ -613,11 +654,15 @@ func Save(cfg Config) (string, error) {
if err := writeSecretFile(cfg.UserMode, path, data); err != nil {
return "", err
}
- return path, nil
- }
- if err := atomicfile.Write(path, data, 0644); err != nil {
+ } else if err := atomicfile.Write(path, data, 0644); err != nil {
return "", err
}
+ // The dashboard switch has to reach accounts that cannot read a root-only config.json.
+ if !cfg.UserMode {
+ if err := syncDashboardMarker(path, cfg.DashboardMode() == DashboardDisabled); err != nil {
+ return "", fmt.Errorf("record the dashboard switch: %w", err)
+ }
+ }
return path, nil
}
diff --git a/cli/beacon/internal/endpoint/config/dashboard_test.go b/cli/beacon/internal/endpoint/config/dashboard_test.go
index 359b2eb7..d4de0fb6 100644
--- a/cli/beacon/internal/endpoint/config/dashboard_test.go
+++ b/cli/beacon/internal/endpoint/config/dashboard_test.go
@@ -32,11 +32,14 @@ func TestDashboardDisabledAt(t *testing.T) {
t.Fatalf("missing config = %v, %v; want enabled", disabled, err)
}
for body, want := range map[string]bool{
- `{"user_mode":false}`: false,
- `{"dashboard":"enabled"}`: false,
- `{"dashboard":"disabled"}`: true,
- `{"dashboard":" Disabled "}`: true,
- `{"dashboard":"other-value"}`: false,
+ `{"user_mode":false}`: false,
+ `{"dashboard":"enabled"}`: false,
+ `{"dashboard":"disabled"}`: true,
+ `{"dashboard":" Disabled "}`: true,
+ // A value --dashboard would refuse fails closed.
+ `{"dashboard":"other-value"}`: true,
+ `{"dashboard":"off"}`: true,
+ `{"dashboard":""}`: false,
} {
if disabled, err := DashboardDisabledAt(write("config.json", body)); err != nil || disabled != want {
t.Errorf("%s = %v, %v; want %v", body, disabled, err, want)
@@ -45,13 +48,53 @@ func TestDashboardDisabledAt(t *testing.T) {
if _, err := DashboardDisabledAt(write("broken.json", `{"dashboard":`)); err == nil {
t.Error("a config that does not parse read as enabled")
}
- if testenv.HasPOSIXFileModes() && os.Geteuid() != 0 {
- path := write("private.json", `{"dashboard":"enabled"}`)
- if err := os.Chmod(path, 0); err != nil {
- t.Fatal(err)
- }
- if _, err := DashboardDisabledAt(path); err == nil {
- t.Error("an unreadable config read as enabled")
- }
+}
+
+// A system config that holds a HEC token is root-only, and the accounts that cannot read it are the
+// ones the switch is for: the marker beside it answers for them.
+func TestDashboardDisabledAtAnUnreadableConfigUsesTheMarker(t *testing.T) {
+ if !testenv.HasPOSIXFileModes() || os.Geteuid() == 0 {
+ t.Skip("needs POSIX file modes and an account that root-only files refuse")
+ }
+ dir := t.TempDir()
+ path := filepath.Join(dir, "config.json")
+ if err := os.WriteFile(path, []byte(`{"dashboard":"disabled","destinations":{}}`), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Chmod(path, 0); err != nil {
+ t.Fatal(err)
+ }
+ if disabled, err := DashboardDisabledAt(path); err != nil || disabled {
+ t.Fatalf("unreadable config, no marker = %v, %v; want enabled with no error", disabled, err)
+ }
+ if err := syncDashboardMarker(path, true); err != nil {
+ t.Fatal(err)
+ }
+ if disabled, err := DashboardDisabledAt(path); err != nil || !disabled {
+ t.Fatalf("unreadable config with the marker = %v, %v; want disabled", disabled, err)
+ }
+}
+
+func TestSyncDashboardMarker(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "config.json")
+ marker := DashboardMarkerPath(path)
+ if err := syncDashboardMarker(path, false); err != nil {
+ t.Fatalf("removing a marker that is not there = %v", err)
+ }
+ if err := syncDashboardMarker(path, true); err != nil {
+ t.Fatal(err)
+ }
+ info, err := os.Stat(marker)
+ if err != nil {
+ t.Fatalf("no marker after disabling: %v", err)
+ }
+ if testenv.HasPOSIXFileModes() && info.Mode().Perm() != 0o644 {
+ t.Errorf("marker mode = %v, want 0644 so every account can read it", info.Mode().Perm())
+ }
+ if err := syncDashboardMarker(path, false); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := os.Stat(marker); !os.IsNotExist(err) {
+ t.Errorf("marker still there after enabling: %v", err)
}
}
diff --git a/cli/beacon/internal/endpoint/lifecycle/dashboard_test.go b/cli/beacon/internal/endpoint/lifecycle/dashboard_test.go
index bdd26b84..df5d6244 100644
--- a/cli/beacon/internal/endpoint/lifecycle/dashboard_test.go
+++ b/cli/beacon/internal/endpoint/lifecycle/dashboard_test.go
@@ -31,6 +31,48 @@ func TestBuildConfigWithoutAnExistingConfigHasTheDashboardOn(t *testing.T) {
}
}
+// A hand-written value --dashboard refuses is carried as disabled, how the dashboard reads it,
+// rather than raw into a preflight that would fail every repair and package upgrade.
+func TestCarriedDashboard(t *testing.T) {
+ for in, want := range map[string]string{
+ "": "", "enabled": "enabled", " Disabled ": "disabled", "off": "disabled", "no": "disabled",
+ } {
+ if got := carriedDashboard(in); got != want {
+ t.Errorf("carriedDashboard(%q) = %q, want %q", in, got, want)
+ }
+ if err := validateDashboard(endpointconfig.Config{Dashboard: carriedDashboard(in)}); err != nil {
+ t.Errorf("carried %q fails preflight: %v", in, err)
+ }
+ }
+ testenv.SetHome(t, t.TempDir())
+ writeInventoryConfig(t, true, `{"user_mode":true,"log_path":"/tmp/runtime.jsonl","dashboard":"off"}`)
+ if cfg := buildConfig(InstallOptions{UserMode: true}); cfg.Dashboard != endpointconfig.DashboardDisabled {
+ t.Fatalf("Dashboard = %q, want a hand-written \"off\" carried as disabled", cfg.Dashboard)
+ }
+}
+
+// Repairing a system config that no longer loads must not turn the dashboard back on: the marker
+// beside it still records the switch.
+func TestBuildConfigKeepsTheDashboardOffWhenTheSystemConfigDoesNotLoad(t *testing.T) {
+ prevMarked, prevRestricted := systemDashboardMarked, logIsRestricted
+ t.Cleanup(func() { systemDashboardMarked, logIsRestricted = prevMarked, prevRestricted })
+ logIsRestricted = func(string) bool { return false }
+ if _, err := endpointconfig.Load(false); err == nil {
+ t.Skip("this machine has a loadable system config")
+ }
+ systemDashboardMarked = func() bool { return true }
+ if cfg := buildConfig(InstallOptions{}); cfg.Dashboard != endpointconfig.DashboardDisabled {
+ t.Fatalf("Dashboard = %q, want disabled from the marker", cfg.Dashboard)
+ }
+ if cfg := buildConfig(InstallOptions{Dashboard: endpointconfig.DashboardEnabled}); cfg.Dashboard != endpointconfig.DashboardEnabled {
+ t.Fatalf("Dashboard = %q, want the explicit --dashboard enabled to win", cfg.Dashboard)
+ }
+ systemDashboardMarked = func() bool { return false }
+ if cfg := buildConfig(InstallOptions{}); cfg.Dashboard != "" {
+ t.Fatalf("Dashboard = %q, want unset without a marker", cfg.Dashboard)
+ }
+}
+
func TestValidateDashboard(t *testing.T) {
for _, mode := range []string{"", "enabled", "disabled", "Disabled"} {
if err := validateDashboard(endpointconfig.Config{Dashboard: mode}); err != nil {
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
index d63ddb1f..42372d7d 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
@@ -991,6 +991,9 @@ func Uninstall(opts UninstallOptions) error {
fail("remove "+cfg.Collector.ConfigPath, os.Remove(cfg.Collector.ConfigPath))
if !opts.KeepManagedIngest {
fail("remove endpoint config", os.Remove(endpointConfigPath))
+ // The marker records the config's dashboard switch; left behind, a later install's
+ // buildConfig would read it as the switch of a config that no longer exists.
+ fail("remove the dashboard switch marker", os.Remove(endpointconfig.DashboardMarkerPath(endpointConfigPath)))
}
}
// The forward's header values are a credential, so they go with config.json whether or not the
@@ -1222,6 +1225,25 @@ func buildStatus(requestedUserMode bool, effectiveCfg endpointconfig.Config, run
}
}
+// carriedDashboard is the dashboard switch a repair or upgrade keeps from the existing config. A
+// value --dashboard would refuse (one written into config.json by hand, such as "off") is kept as
+// disabled, which is how the dashboard already reads it, rather than carried raw into a preflight
+// that would then fail every repair and package upgrade over a flag nobody passed.
+func carriedDashboard(value string) string {
+ mode, err := endpointconfig.ParseDashboardMode(value)
+ if err != nil {
+ return endpointconfig.DashboardDisabled
+ }
+ return mode
+}
+
+// systemDashboardMarked reports whether the disabled-dashboard marker sits beside the system config.
+// A variable so tests need not write to the system config directory.
+var systemDashboardMarked = func() bool {
+ _, err := os.Stat(endpointconfig.DashboardMarkerPath(endpointconfig.SystemConfigPath()))
+ return err == nil
+}
+
// systemDashboardDisabled is the seam status reads the administrator's dashboard switch through.
var systemDashboardDisabled = endpointconfig.SystemDashboardDisabled
@@ -1319,12 +1341,19 @@ func buildConfig(opts InstallOptions) endpointconfig.Config {
// it would silently make a restricted log world-writable again.
cfg.LogAccess = existing.LogAccess
// The dashboard switch is an administrator's choice too; an upgrade must not turn it back on.
- cfg.Dashboard = existing.Dashboard
- } else if !opts.UserMode && logIsRestricted(cfg.LogPath) {
- // No config to carry the mode over from -- an uninstall with --keep-logs removed it, or it
- // does not load -- but the root-owned marker beside the kept log still records restricted.
- // Defaulting to shared here would make every kept event world-readable.
- cfg.LogAccess = asymptoteobserve.LogAccessRestricted
+ cfg.Dashboard = carriedDashboard(existing.Dashboard)
+ } else if !opts.UserMode {
+ if logIsRestricted(cfg.LogPath) {
+ // No config to carry the mode over from -- an uninstall with --keep-logs removed it, or it
+ // does not load -- but the root-owned marker beside the kept log still records restricted.
+ // Defaulting to shared here would make every kept event world-readable.
+ cfg.LogAccess = asymptoteobserve.LogAccessRestricted
+ }
+ if systemDashboardMarked() {
+ // Likewise a config that no longer loads still has the dashboard marker beside it, so a
+ // repair of a damaged file keeps the dashboard off instead of turning it back on.
+ cfg.Dashboard = endpointconfig.DashboardDisabled
+ }
}
if opts.LogAccess != "" {
cfg.LogAccess = opts.LogAccess
diff --git a/docs/cli/endpoint-install.mdx b/docs/cli/endpoint-install.mdx
index 4c1c582b..98e654ef 100644
--- a/docs/cli/endpoint-install.mdx
+++ b/docs/cli/endpoint-install.mdx
@@ -336,11 +336,14 @@ sudo beacon endpoint install --system --dashboard disabled
The setting is recorded in the system `config.json` as `"dashboard": "disabled"` and kept by
`beacon endpoint repair`, package upgrades and reinstalls until `--dashboard enabled` turns it back
on. While it is off, `beacon endpoint dashboard` and `beacon lenses preview` refuse to start for
-everyone, including a user-mode run on the same machine. The check needs no privileges: while the
-switch is off, install also keeps a world-readable `dashboard-disabled` marker beside the system
-config, which answers for accounts that cannot read a root-only config (one holding a HEC token). A
-system config that is readable but does not parse refuses too, and an unrecognized value reads as
-disabled.
+everyone, including a user-mode run on the same machine. The check needs no privileges. Once the
+system config holds a Splunk or Falcon HEC token it is readable only by root (SYSTEM and
+Administrators on Windows), so install and repair also keep a `dashboard-disabled` file beside it
+while the dashboard is off, which every account can read; an account that cannot read
+`config.json` goes by that file. Any value other than `enabled` (or none) reads as disabled, and a
+system config that does not parse refuses too, so a damaged or mistyped setting never turns the
+dashboard back on. If you edit `config.json` by hand, run `beacon endpoint repair --system` so the
+file beside it follows.
`beacon endpoint status` prints `Dashboard: enabled` or `Dashboard: disabled by the administrator`
(`dashboard` in `--json`). `--dashboard` is refused in user mode, whose config would switch nothing off.
diff --git a/packaging/macos/smoke-vscode-endpoint.sh b/packaging/macos/smoke-vscode-endpoint.sh
index 313f8a31..9ce0bf45 100755
--- a/packaging/macos/smoke-vscode-endpoint.sh
+++ b/packaging/macos/smoke-vscode-endpoint.sh
@@ -44,10 +44,17 @@ JSON
"$TMPDIR/beacon" endpoint dashboard --log-path "$LOG" --addr "$DASHBOARD_ADDR" >"$TMPDIR/dashboard.log" 2>&1 &
DASHBOARD_PID="$!"
+# The dashboard answers only a browser that opened the launch URL it prints, which carries a
+# per-launch token: opening it sets the session cookie (through a 303 back to the page), and the API
+# requests after it send that cookie.
+COOKIES="$TMPDIR/dashboard-cookies"
SUMMARY=""
i=0
while [ "$i" -lt 20 ]; do
- SUMMARY="$(curl -fsS "http://$DASHBOARD_ADDR/api/summary" 2>/dev/null || true)"
+ LAUNCH_URL="$(sed -n 's/^Beacon endpoint dashboard: //p' "$TMPDIR/dashboard.log" 2>/dev/null | head -n 1)"
+ if [ -n "$LAUNCH_URL" ] && curl -fsSL -c "$COOKIES" -b "$COOKIES" -o /dev/null "$LAUNCH_URL" 2>/dev/null; then
+ SUMMARY="$(curl -fsS -b "$COOKIES" "http://$DASHBOARD_ADDR/api/summary" 2>/dev/null || true)"
+ fi
if [ -n "$SUMMARY" ]; then
break
fi