In self-hosted multi-organization mode the tenant check let every
signed-in session or proxy user into the default organization, so a
user invited only to another organization could read the default
estate by selecting it with the org header or cookie.
The default organization is now open there only to instance
administrators (local admin, an RBAC admin grant evaluated with
inheritance and deny precedence, or a proxy user admitted with the
admin role) and to explicit members recorded in its org.json, loaded
strictly. Having no other membership is never treated as access.
Single-tenant and hosted runtimes keep the open default organization.
One context-aware policy now serves tenant selection, action
authority, the organization handlers and the WebSocket hub, which
also checks the default organization. WebSocket, SSE and agent-event
streams re-check it every 10 seconds, so revoked access ends live
reads. Handlers that re-derive the org from the request now follow
the authorized org.
A request that names no organization lands in the user's first
organization. A refused default selection answers
default_org_access_denied; the browser clears it and retries reads
only. A user with no usable organization sees their pending
invitations instead of a connection failure.
Instance administrators manage default members from Organization
access. Members are viewers, membership is the only entitlement (an
owner field grants nothing), and every save of the default
organization keeps its current members, so a share or invitation
change made from an older snapshot cannot restore a revoked one. The first
start in this mode seeds RBAC-assigned users who belong to no other
organization, and retries rather than completing on unreadable
tenant metadata or RBAC data.
Listing an organization's invitations now returns [] instead of null
when none are pending; the Organization access panel rejected null and
showed "Organization access unavailable" to any org admin without
pending invitations.
The organization-owner fix judged browser sessions only. API tokens on
instance routes were still checked for scope alone, and the tenant
middleware resolves an org-bound token to its own organization without
the caller naming one. A token bound to a tenant organization and
holding settings:write therefore reached system settings, SSO
providers, token management, relay, log level, updates and the other
instance surfaces.
ensureAdminSession, behind RequireAdmin, and ensureSettingsScope now
refuse a token unless it acts for the instance: not bound to any
organization other than the default one, with OrgIDs taking precedence
over OrgID. The route's scope still applies. The org variants
(RequireOrgAdmin, ensureOrgAdminSession, ensureOrgSettingsWriteScope)
keep judging tokens by scope alone. tokenHasInstanceWideAuthority is
now the same binding rule plus full-access scope.
The test notification broadcasts only to the request organization, so
it moves to RequireOrgAdmin. Its tenant delivery test already relied on
an org-bound token sending it, and that organization's managers may now
send it from a session too.
No path an organization manager can reach mints a settings scope: relay
mobile, install, deploy and action-runner tokens carry relay, agent and
report scopes only, and token management is instance administration.
The API reference and the api-contracts, security-privacy,
agent-lifecycle and storage-recovery contracts record the token rule.
ensureAdminSession, the session check behind RequireAdmin and the
settings scope helpers, admitted anyone who could manage the
organization named in the request. That was meant for the org-bound
settings pages, but it applied to every admin route. On a multi-tenant
install an organization owner could therefore rotate the instance
administrator's API token and receive its secret, widen any token's
scopes, add or replace SSO providers, change system settings, relay
and log level, apply or roll back updates, restart the service, and
read instance logs and diagnostics.
ensureAdminSession now admits only instance administrators: the
configured admin or an instance RBAC admin grant, whichever org the
request names. Routes whose handlers act only on the request
organization opt in explicitly through RequireOrgAdmin,
ensureOrgAdminSession or ensureOrgSettingsWriteScope, which also admit
that organization's owners and admins. Those routes cover agents,
nodes, connections, availability, TrueNAS and VMware, agent profiles,
install commands, deploy status, configuration transfer and the
org-bound relay mobile token. Anything that does not opt in fails
closed.
Reporting stays instance administration, and the security status
snapshot stops offering it to org managers, because report generation
still reads the instance's default metrics store. Notifications,
LAN discovery and the action-capability fallback also stay instance
administration. The two credential routes no longer need their own
check, so ensureInstanceAdminSession is folded into this rule.
The loopback gate from 586473ee3 rejected non-loopback setup requests
before the bootstrap-token check could run, so a Proxmox-LXC install
(install script prints URL + token; user opens URL on workstation,
pastes token) hit "only available from localhost" even with the correct
token. The token is the security boundary — only callers with
filesystem access to the data dir can read it — so a valid token now
authorizes setup from any origin. No-token requests still require
direct loopback.
Updates the two contract/setup tests that pinned the old behavior.
Fixes discussion #1459.
- Replace barrel import in AuditLogPanel.tsx to fix ad-blocker crash
- Remove all Enterprise/Pro badges from nav and feature headers
- Simplify upgrade CTAs to clean 'Upgrade to Pro' links
- Update docs: PULSE_PRO.md, API.md, README.md, SECURITY.md
- Align terminology: single Pro tier, no separate Enterprise tier
Also includes prior refactoring:
- Move auth package to pkg/auth for enterprise reuse
- Export server functions for testability
- Stabilize CLI tests