Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Make portal account context permission-honest

rcourtman90c33da77748
diff --git a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
index 2f7b3207f4..f6b19a3a41 100644
--- a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
+++ b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
@@ -204,6 +204,10 @@ Core rules:
`Access`, and hosted `Billing` may not advertise create, roster-mutation,
or hosted-billing actions when the current account role cannot perform
them; those surfaces must say that an owner or admin is required.
+30. The compact account-context strip must also stay permission-honest. It
+ must describe what the current user can actually do on the account, not
+ restate the account's full hosted capability set when access or billing
+ changes require an owner or admin.
## Screen Model
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 65df6075f0..cfb32a45c7 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -305,6 +305,9 @@ honest for hosted view-only roles: when `can_manage` is false, `Workspaces`,
`Access`, and hosted `Billing` must stop advertising create, roster-mutation,
or hosted-billing actions and must instead state that an owner or admin is
required.
+The same permission contract must also drive the compact account-context
+summary: the strip may not describe full hosted access-control or billing
+ownership when the current role can only review workspaces or roster state.
plus a package-local `tsc --noEmit` gate, so future account-shell work should
extend the typed source boundary instead of reviving opaque global runtime
objects, document-wide render events, or untyped embedded asset edits.
@@ -1783,6 +1786,11 @@ The shared direct-node/discovery settings boundary now also includes
customer-facing mutation and validation copy used by the governed runtime
hooks stays explicit under the same API-backed settings proof instead of
living as an unowned utility.
+That same backend-owned config/settings boundary also owns shipped security-doc
+references in operator guidance. `internal/api/config_system_handlers.go` and
+shared setup helpers must not point API responses or runtime guidance at
+GitHub `main` for security instructions that the running build already serves
+locally; those references belong on the shipped `/docs/SECURITY.md` path.
That same governed token contract must fail closed on mutation. Limited-scope
API tokens may only create, rotate, or delete tokens whose effective scopes
are a subset of the caller's own scopes; token-management routes must not let a
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index d6aa888950..01f462379b 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -864,6 +864,9 @@ permissions: when the current role is view-only, `Workspaces`, `Access`, and
hosted `Billing` copy must not advertise create, roster-mutation, or hosted
billing actions that the runtime will not allow. Those surfaces must say that
an owner or admin is required instead of implying blocked jobs are live.
+The same rule applies to the compact account-context strip: it must describe
+the current user's effective hosted tasks, not restate full access-control and
+billing capability when those actions are blocked behind owner/admin roles.
That same canonical shell/runtime boundary now also owns the bootstrap truth
for when self-hosted commercial history is relevant. Hosted-only accounts must
not render self-hosted license, refund, privacy, or support-escalation copy
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.json
index 6927ad1b0f..d5f25d6bfc 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "b93536d18693dc62fbb55c10bf281abe311c713d28950670c960e116940abccf",
+ "source_hash": "f9e6d5b177cc9d390fdf659da4acb4335a14f618e32b0f31599072dbe6fe1d79",
"build_inputs": [
"package.json",
"tsconfig.json",
diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.js
index e030596bd4..5ff4e84a26 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -2027,10 +2027,27 @@
}
return results;
}
+ function accountContextRoleMeta(account) {
+ return titleCase(account.role) + (account.can_manage ? " access" : " role");
+ }
+ function accountContextLeadCopy(account) {
+ var accountPrefix = account.kind === "msp" ? "Hosted workspace account" : "Hosted account";
+ if (account.can_manage) {
+ return accountPrefix + (account.has_billing ? " for workspace access, access control, and billing." : " for workspace access and access control.");
+ }
+ return accountPrefix + (account.has_billing ? " where you can open workspaces and review who already has access. An owner or admin handles access changes and billing." : " where you can open workspaces and review who already has access. An owner or admin handles account changes.");
+ }
+ function accountContextAccessSummary(account) {
+ return account.can_manage ? titleCase(account.role) : "View only";
+ }
+ function accountContextBillingSummary(account) {
+ if (!account.has_billing) return "Not attached";
+ return account.can_manage ? "Billing enabled" : "Owner/admin required";
+ }
function renderAccountContextStrip(account) {
var workspaceLabel = workspaceCountLabel((account.workspaces || []).length);
- var billingLabel = account.has_billing ? "Billing enabled" : "Billing offline";
- return '<section class="portal-account-context"><div class="portal-account-context-copy"><div class="portal-account-context-meta"><span class="account-eyebrow">' + escapeHTML(accountKindLabel(account)) + '</span><span class="portal-account-context-separator">/</span><span class="portal-account-context-access">' + escapeHTML(titleCase(account.role)) + ' access</span></div><div class="portal-account-context-row"><h2>' + escapeHTML(account.name) + '</h2><div class="portal-account-context-chips"><span class="account-context-chip">' + escapeHTML(account.kind_label) + '</span><span class="account-context-chip">' + escapeHTML(titleCase(account.role)) + '</span><span class="account-context-chip">' + escapeHTML(workspaceLabel) + "</span></div></div><p>" + escapeHTML(account.kind === "msp" ? "Hosted workspace account for workspace access, access control, and billing." : "Hosted account for workspace access, access control, and billing.") + '</p></div><div class="portal-account-context-summary"><div class="portal-account-context-stat"><span>Access</span><strong>' + escapeHTML(titleCase(account.role)) + '</strong></div><div class="portal-account-context-stat"><span>Workspaces</span><strong>' + escapeHTML(workspaceLabel) + '</strong></div><div class="portal-account-context-stat"><span>Billing</span><strong>' + escapeHTML(billingLabel) + "</strong></div></div></section>";
+ var billingLabel = accountContextBillingSummary(account);
+ return '<section class="portal-account-context"><div class="portal-account-context-copy"><div class="portal-account-context-meta"><span class="account-eyebrow">' + escapeHTML(accountKindLabel(account)) + '</span><span class="portal-account-context-separator">/</span><span class="portal-account-context-access">' + escapeHTML(accountContextRoleMeta(account)) + '</span></div><div class="portal-account-context-row"><h2>' + escapeHTML(account.name) + '</h2><div class="portal-account-context-chips"><span class="account-context-chip">' + escapeHTML(account.kind_label) + '</span><span class="account-context-chip">' + escapeHTML(titleCase(account.role)) + '</span><span class="account-context-chip">' + escapeHTML(workspaceLabel) + "</span></div></div><p>" + escapeHTML(accountContextLeadCopy(account)) + '</p></div><div class="portal-account-context-summary"><div class="portal-account-context-stat"><span>Access</span><strong>' + escapeHTML(accountContextAccessSummary(account)) + '</strong></div><div class="portal-account-context-stat"><span>Workspaces</span><strong>' + escapeHTML(workspaceLabel) + '</strong></div><div class="portal-account-context-stat"><span>Billing</span><strong>' + escapeHTML(billingLabel) + "</strong></div></div></section>";
}
function shellSectionButton(section, activeSection, index, title, copy, badge) {
var badgeHTML = badge ? '<span class="portal-shell-nav-badge">' + escapeHTML(badge) + "</span>" : "";
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
index 44f5955e07..c5a6a3ade7 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
@@ -344,6 +344,7 @@ describe('shell view', function() {
expect((html.match(/portal-account-context-stat/g) || []).length).toBe(3);
expect((html.match(/account-context-chip\"/g) || []).length).toBe(3);
expect(html).toContain('Admin access');
+ expect(html).toContain('Hosted account for workspace access, access control, and billing.');
expect(html).toContain('Billing enabled');
});
@@ -377,6 +378,10 @@ describe('shell view', function() {
expect(html).toContain('Open a workspace and review current state. An owner or admin must create or change hosted workspaces.');
expect(html).toContain('Open a workspace and review current state here. An owner or admin must create or change hosted workspaces.');
+ expect(html).toContain('Tech role');
+ expect(html).toContain('Hosted account where you can open workspaces and review who already has access. An owner or admin handles access changes and billing.');
+ expect(html).toContain('View only');
+ expect(html).toContain('Owner/admin required');
expect(html).toContain('Review access');
expect(html).toContain('Owner or admin required');
expect(html).toContain('Review who already has access to this hosted account. An owner or admin must make changes.');
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.ts
index 923ca36645..d2d6780e8e 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts
@@ -300,9 +300,34 @@ function renderOverviewMetricStrip(
);
}
+function accountContextRoleMeta(account: PortalAccountSummary): string {
+ return titleCase(account.role) + (account.can_manage ? ' access' : ' role');
+}
+
+function accountContextLeadCopy(account: PortalAccountSummary): string {
+ var accountPrefix = account.kind === 'msp' ? 'Hosted workspace account' : 'Hosted account';
+ if (account.can_manage) {
+ return accountPrefix + (account.has_billing
+ ? ' for workspace access, access control, and billing.'
+ : ' for workspace access and access control.');
+ }
+ return accountPrefix + (account.has_billing
+ ? ' where you can open workspaces and review who already has access. An owner or admin handles access changes and billing.'
+ : ' where you can open workspaces and review who already has access. An owner or admin handles account changes.');
+}
+
+function accountContextAccessSummary(account: PortalAccountSummary): string {
+ return account.can_manage ? titleCase(account.role) : 'View only';
+}
+
+function accountContextBillingSummary(account: PortalAccountSummary): string {
+ if (!account.has_billing) return 'Not attached';
+ return account.can_manage ? 'Billing enabled' : 'Owner/admin required';
+}
+
function renderAccountContextStrip(account: PortalAccountSummary): string {
var workspaceLabel = workspaceCountLabel((account.workspaces || []).length);
- var billingLabel = account.has_billing ? 'Billing enabled' : 'Billing offline';
+ var billingLabel = accountContextBillingSummary(account);
return (
'<section class="portal-account-context">' +
@@ -310,7 +335,7 @@ function renderAccountContextStrip(account: PortalAccountSummary): string {
'<div class="portal-account-context-meta">' +
'<span class="account-eyebrow">' + escapeHTML(accountKindLabel(account)) + '</span>' +
'<span class="portal-account-context-separator">/</span>' +
- '<span class="portal-account-context-access">' + escapeHTML(titleCase(account.role)) + ' access</span>' +
+ '<span class="portal-account-context-access">' + escapeHTML(accountContextRoleMeta(account)) + '</span>' +
'</div>' +
'<div class="portal-account-context-row">' +
'<h2>' + escapeHTML(account.name) + '</h2>' +
@@ -320,12 +345,12 @@ function renderAccountContextStrip(account: PortalAccountSummary): string {
'<span class="account-context-chip">' + escapeHTML(workspaceLabel) + '</span>' +
'</div>' +
'</div>' +
- '<p>' + escapeHTML(account.kind === 'msp' ? 'Hosted workspace account for workspace access, access control, and billing.' : 'Hosted account for workspace access, access control, and billing.') + '</p>' +
+ '<p>' + escapeHTML(accountContextLeadCopy(account)) + '</p>' +
'</div>' +
'<div class="portal-account-context-summary">' +
'<div class="portal-account-context-stat">' +
'<span>Access</span>' +
- '<strong>' + escapeHTML(titleCase(account.role)) + '</strong>' +
+ '<strong>' + escapeHTML(accountContextAccessSummary(account)) + '</strong>' +
'</div>' +
'<div class="portal-account-context-stat">' +
'<span>Workspaces</span>' +