Agent Mesh
Go a2aa2a-protocolagent-meshagentic-aiinferencemcpmeshmesh-networknetwork-securitynetworking-aip2p-network
console: list revoked nodes for admins with a Restore button
Tomas Tormoca974aa00a75
diff --git a/internal/console/public/app.js b/internal/console/public/app.jsindex 4b87f908..a5fa5211 100644--- a/internal/console/public/app.js+++ b/internal/console/public/app.js@@ -219,8 +219,8 @@ async function loadData() {}}- // A revoked node is banned, not deleted: the record survives for unban- // and audit, but it is out of the mesh, so no view may list it.+ // A revoked node is banned, not deleted: the record survives for restore+ // and audit, but it is out of the mesh, so only the admins' revoked list shows it.const enrolledNodes = (data.enrolled_nodes || []).filter(node => !node.banned);// Update Stats@@ -248,6 +248,7 @@ async function loadData() {setTableMessage('table-enrollments', 4, 'Restricted to administrators.');}renderNodesTable(enrolledNodes, role);+ renderRevokedNodesTable(role === 'admin' ? (data.enrolled_nodes || []).filter(node => node.banned) : []);renderServicesTable(data.node_catalog || {}, buildLabelsByPeer(enrolledNodes));renderRoutersTable(data.active_routers || []);renderRouterTopography(data.active_routers || []);@@ -413,6 +414,24 @@ window.setAutonomousRecovery = function(peerID, enabled) {}};+function renderRevokedNodesTable(nodes) {+ document.getElementById('revoked-nodes').hidden = nodes.length === 0;+ document.getElementById('table-revoked-nodes').innerHTML = nodes.map(node => `+ <tr>+ <td>${peerCell(node.peer_id, node.labels)}</td>+ <td>${escapeHTML(node.role)}</td>+ <td>${escapeHTML(node.owner_id || '')}</td>+ <td><button class="btn btn-sm" onclick="restoreNode('${escapeHTML(node.peer_id)}')">Restore</button></td>+ </tr>+ `).join('');+}++window.restoreNode = function(peerID) {+ if (confirm('Restore this node? Its key and the identity behind it may join the mesh again.')) {+ actionRequest(`api/admin/nodes/${peerID}/unban`).catch(() => {});+ }+};+// node_catalog is {peerID: {services: [{name, type, description}], report_time}},// already restricted server-side to nodes that are still admitted; type is// the ServiceType enum name ("SERVICE_TYPE_MCP"), shown as its short form.diff --git a/internal/console/public/index.html b/internal/console/public/index.htmlindex d2b28234..66efd133 100644--- a/internal/console/public/index.html+++ b/internal/console/public/index.html@@ -205,6 +205,27 @@</table></div></div>+ <!-- Admins only: a revoked node keeps its record, so it can be restored. -->+ <div id="revoked-nodes" hidden>+ <div class="section-header section-header-spaced">+ <h2>Revoked Nodes</h2>+ </div>+ <div class="card">+ <div class="table-responsive">+ <table class="data-table">+ <thead>+ <tr>+ <th>Node ID</th>+ <th>Type</th>+ <th>Owner</th>+ <th>Actions</th>+ </tr>+ </thead>+ <tbody id="table-revoked-nodes"></tbody>+ </table>+ </div>+ </div>+ </div></section><!-- Services View: self-reported by each node (see /nodes/catalog);diff --git a/site/content/docs/concepts/identity.md b/site/content/docs/concepts/identity.mdindex 8a2d937a..328f31ab 100644--- a/site/content/docs/concepts/identity.md+++ b/site/content/docs/concepts/identity.md@@ -238,8 +238,8 @@ Revocation operates at two levels:shares the root authority block's `RevocationIds()[0]`, revoking the rootcredential invalidates every attenuated task token derived from it acrossthe mesh. If the node was enrolled through OIDC, the identity behind it- (`issuer|subject`) is banned too. `POST /admin/nodes/{peer_id}/unban`- reverses both bans.+ (`issuer|subject`) is banned too. `POST /admin/nodes/{peer_id}/unban`, or+ **Restore** in the console's Revoked Nodes list, reverses both bans.2. **Local task token revocation (`POST /oauth/revoke`):**When an orchestrator or sandbox finishes a task before its TTL expires, itcalls `POST /oauth/revoke` (RFC 7009) on the local `agentmesh-node`, which recordsdiff --git a/site/content/docs/guides/headless-enrollment.md b/site/content/docs/guides/headless-enrollment.mdindex 4f77ae68..871433cd 100644--- a/site/content/docs/guides/headless-enrollment.md+++ b/site/content/docs/guides/headless-enrollment.md@@ -251,6 +251,6 @@ curl -fsS -X POST https://mesh.example.com/admin/revoke \```The node's next refresh fails and its daemon exits. Connected peers drop it-as soon as the ban event reaches them. `POST /admin/nodes/<peer-id>/unban`-reverses the ban. `agentmesh-control-plane admin ban --peer <id>` and `unban` do+as soon as the ban event reaches them. `POST /admin/nodes/<peer-id>/unban`,+or **Restore** in the console's Revoked Nodes list, reverses the ban. `agentmesh-control-plane admin ban --peer <id>` and `unban` dothe same directly in the database, for cases where the API is not reachable.diff --git a/tests/ui/console.spec.js b/tests/ui/console.spec.jsindex 9003cb93..07999c5e 100644--- a/tests/ui/console.spec.js+++ b/tests/ui/console.spec.js@@ -421,3 +421,25 @@ test('revoked nodes disappear from the Nodes view and the node count', async ({await expect(page.locator('#table-nodes')).not.toContainText(REVOKED);await expect(page.locator('#stat-nodes')).toHaveText('1');});++// A revoke only bans the record, so the console offers the way back.+test('an admin restores a revoked node from the Nodes view', async ({ page }) => {+ const REVOKED = '12D3KooWRevokedNodeFixturePeer';+ await page.route('**/api/admin/status', async (route) => {+ const response = await route.fetch();+ const status = await response.json();+ status.enrolled_nodes = [{ peer_id: REVOKED, role: 'mesh:role:node', owner_id: 'root-admin', banned: true }];+ await route.fulfill({ response, json: status });+ });+ let unban = '';+ await page.route('**/api/admin/nodes/*/unban', async (route) => {+ unban = `${route.request().method()} ${new URL(route.request().url()).pathname}`;+ await route.fulfill({ status: 204 });+ });++ await login(page);+ await page.click('.nav-item[data-target="nodes"]');+ page.once('dialog', (d) => d.accept());+ await page.locator('#table-revoked-nodes tr', { hasText: REVOKED }).locator('button:has-text("Restore")').click();+ await expect.poll(() => unban).toBe(`POST /api/admin/nodes/${REVOKED}/unban`);+});