@hivemagnus/magnus-ui 3.6.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +5 -4
- package/README.md +52 -4
- package/bin/magnus-ui.mjs +118 -2
- package/dist/app/apps/dashboard/.next/BUILD_ID +1 -1
- package/dist/app/apps/dashboard/.next/build-manifest.json +3 -3
- package/dist/app/apps/dashboard/.next/prerender-manifest.json +3 -3
- package/dist/app/apps/dashboard/.next/required-server-files.json +2 -16
- package/dist/app/apps/dashboard/.next/routes-manifest.json +9 -20
- package/dist/app/apps/dashboard/.next/server/app/_global-error.html +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/[anomalyId]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/[anomalyId]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/remediation/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/anomalies/remediation/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/auth/hive/callback/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/auth/hive/configured/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/auth/hive/start/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/auth/login/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/auth/logout/route.js +6 -5
- package/dist/app/apps/dashboard/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/auth/me/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/control-nodes/[id]/route.js +2 -2
- package/dist/app/apps/dashboard/.next/server/app/api/control-nodes/[id]/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/control-nodes/route.js +2 -2
- package/dist/app/apps/dashboard/.next/server/app/api/control-nodes/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/federation/route.js +3 -3
- package/dist/app/apps/dashboard/.next/server/app/api/federation/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/health/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/hermes/dashboard/[[...path]]/route.js +8 -6
- package/dist/app/apps/dashboard/.next/server/app/api/hermes/dashboard/[[...path]]/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/hive-router/dashboard/[[...path]]/route.js +7 -5
- package/dist/app/apps/dashboard/.next/server/app/api/hive-router/dashboard/[[...path]]/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/proxy/[...path]/route.js +5 -5
- package/dist/app/apps/dashboard/.next/server/app/api/proxy/[...path]/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/terminal/close/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/terminal/input/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/terminal/open/route.js +4 -4
- package/dist/app/apps/dashboard/.next/server/app/api/terminal/open/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/terminal/resize/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api-docs/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/api-docs/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/application-operations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/application-operations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/installations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/installations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/[id]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/[id]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/ardent/profiles/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/audit/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/audit/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/codex/installations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/codex/installations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/codex/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/codex/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/commands/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/commands/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/cron/page/server-reference-manifest.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/cron/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/cron/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/cron/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/files/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/files/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-map/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-map/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-readiness/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/fleet-timeline/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/governor/operations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/governor/operations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/hermes-drift/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/hermes-security/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/hermes-security/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/incidents/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/incidents/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/incidents/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/library/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/library/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/library/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/login/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/logs/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/logs/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/mission-control/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/mission-control/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/mission-control/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/nodes/[nodeId]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/nodes/[nodeId]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/nodes/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/nodes/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/nodes/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/notifications/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/notifications/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/installations/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/installations/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/profiles/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/profiles/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/web-gateway/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/orchestra/web-gateway/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/retention/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/retention/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/retention/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/roles/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/roles/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/roles/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/rollouts/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/rollouts/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/[caseId]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/[caseId]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/cases/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/entities/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/entities/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/events/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/events/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/evidence/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/evidence/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/policies/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/policies/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/sources/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/security-fusion/sources/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/skills/page/server-reference-manifest.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/skills/page.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/skills/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/[id]/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/[id]/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/new/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/new/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/page.js.nft.json +1 -1
- package/dist/app/apps/dashboard/.next/server/app/webhooks/page_client-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/{[externals]__0lufsyh_0gqup._.js → [externals]__1k43kg5-icx7b._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__0vzssf5bgd660._.js → [root-of-the-server]__0ndj_rhwp_6vf._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/[root-of-the-server]__0ywmf3079vsm1._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__05vapur0p6d-l._.js → [root-of-the-server]__15_4jl4ba_7y3._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__0iiv9pxo2yauj._.js → [root-of-the-server]__1cxla67mqwfdr._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__0fwm7idn_76uf._.js → [root-of-the-server]__1rrn6p9afghbt._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/{[root-of-the-server]__0ioimsx71gr0o._.js → [root-of-the-server]__1wj2nw17pv5g8._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/_0jvoc4-ta3zc0._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/_0oj6_-g5b2lvi._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/_0rwz3f0jh1ty0._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/_0s788ryrplkp6._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/_1-ntqfqk_4-f0._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/_120rsoc_nc7_3._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/_1ilhtkg33m99h._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/_1xodprib7qa_j._.js +2 -2
- package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_runtime-embed-isolation_mjs_1ovehd-pl97ex._.js +3 -0
- package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_src_lib_auth_ts_1hhq1tq6hjj-e._.js +2 -2
- package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_src_lib_control-nodes-store_ts_01hjyte7nc7l2._.js +3 -2
- package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_src_lib_embedded-frame_ts_1dw1tog69m3ap._.js +3 -0
- package/dist/app/apps/dashboard/.next/server/chunks/apps_dashboard_src_lib_hive-login_ts_0ab2iq7-rpy13._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/[root-of-the-server]__02wumq04h7-2m._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1koj-a25tcc9z._.js → [root-of-the-server]__0az7ayfxt936j._.js} +2 -2
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__02rfo46o0ocq7._.js → [root-of-the-server]__0cbjirfjkahyz._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__0l7okklk-ix9t._.js → [root-of-the-server]__0mtl30w3r3d8n._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1w1bkuf_-8zxm._.js → [root-of-the-server]__0n1mehgazoyys._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1y4za7l5ph9o-._.js → [root-of-the-server]__0piptu4qrcax4._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__0neu-iblb1_-5._.js → [root-of-the-server]__0qoxqg_z229qc._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1jb0a4bkg6dd1._.js → [root-of-the-server]__0yvtveej1dtd6._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__000ndthd0hd5v._.js → [root-of-the-server]__0zftzxoekcfyw._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__202zczfuwkbzi._.js → [root-of-the-server]__15i5sz08w-tg0._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1ria97bl22vsq._.js → [root-of-the-server]__18k_-53xs-qpk._.js} +2 -2
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1jtg9fc0ny1cg._.js → [root-of-the-server]__1cesdboqyg7rq._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1wsrd6m1h8q7q._.js → [root-of-the-server]__1p0rsbsf87odz._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1l8__2gqqi590._.js → [root-of-the-server]__1un9oi8-bokqt._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/{[root-of-the-server]__1gwofuehw8lyc._.js → [root-of-the-server]__206hwh476sy80._.js} +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/_07u8d93e_m_yo._.js +3 -2
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/_0caxc2bc6a__r._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/_1oebzzj_en62h._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_runtime-environment_mjs_11tpywm9_soif._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_0gs_s688kgg1i._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_anomalies_remediation_page_tsx_179m33swiclif._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_ardent_installations_page_tsx_0nvqgacugy6nf._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_audit_audit-client_tsx_0iyab_tlw5yus._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_cron_page_tsx_1i3duyygc0_tg._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_files_page_tsx_1kls9-qinldks._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_governor_operations_page_tsx_1tvdkgil8mlgk._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_login_page_tsx_12_rihimtav2a._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_logs_page_tsx_0473-hcpj1mqr._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_mission-control_page_tsx_0crgxncex_u3w._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_nodes_[nodeId]_page_tsx_1q7fqu18oklzc._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_nodes_nodes-client_tsx_0pt4iarhpqbgn._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_orchestra_web-gateway_page_tsx_1fz12np0wk27t._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_security-fusion_page_tsx_0d314q7yh6fx8._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_skills_page_tsx_0n5zp4xad38in._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_app_webhooks_webhook-form_tsx_02z3be5wx7-cb._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_components_ui_card_tsx_1pngl2ib-xo5t._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_components_ui_node-selector_tsx_1ci6ldznpaofq._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/chunks/ssr/apps_dashboard_src_lib_api-client_ts_0tho-kkk5ez7h._.js +1 -1
- package/dist/app/apps/dashboard/.next/server/middleware-build-manifest.js +3 -3
- package/dist/app/apps/dashboard/.next/server/pages/500.html +1 -1
- package/dist/app/apps/dashboard/.next/server/preview-props.json +3 -3
- package/dist/app/apps/dashboard/.next/server/server-reference-manifest.js +1 -1
- package/dist/app/apps/dashboard/.next/server/server-reference-manifest.json +3 -3
- package/dist/app/apps/dashboard/.next/static/chunks/{369vzlcjad-gn.js → 017x1uhn9l7nw.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/{1-vn8cqro-f08.js → 06_2psos--paq.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/0i8g96dmx-fbo.css +2 -0
- package/dist/app/apps/dashboard/.next/static/chunks/0nalo72r7vipw.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/0pswbe-19xxl5.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/{3ntnj6ts2r3e2.js → 0s2skhp7086pc.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/{0nekvgtqt8goj.js → 0zsp_alwy1f3v.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/1fpi73pmpn8v5.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/1gko0bkguj_g0.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/{0lxf5l-ugq-09.js → 1t6g3-pjlavb5.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/{1bn40ef0zair9.js → 1ygangs-zn4yl.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/2_eadjwf4989d.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/2fzv4_us4q1w_.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/{1cvbtmsr4d3ci.js → 2isl5q2zhjwiw.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/2jaw-lni6k_dt.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/2sh8fn_vg-vs5.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/{1kx48jg-4j5iv.js → 2u4_fj_v8i521.js} +2 -2
- package/dist/app/apps/dashboard/.next/static/chunks/{0d6kculhmue59.js → 2zj24fir1fm27.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/{3w-7xko96ljib.js → 2zjjqqg5z63sl.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/337js55ro9g08.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/{37kstof-v-jwi.js → 33xay7yclh_jd.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/34yff9n0mbd1h.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/{05p7s0xtb3koa.js → 3eo_31lzj51v9.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/{12ju76tjcqh_z.js → 3f73kvi1pwabq.js} +4 -4
- package/dist/app/apps/dashboard/.next/static/chunks/{23o8zfgrdxuhk.js → 3kh386y5gla53.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/3mwn69j8d-q9v.js +4 -0
- package/dist/app/apps/dashboard/.next/static/chunks/3p_wvl3sieoi4.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/{0yb36s9l-f3_w.js → 3qrrim22gq-vp.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/3ui3xvxcdyc0r.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/3ya4-24grz_0f.js +1 -0
- package/dist/app/apps/dashboard/.next/static/chunks/{37pb0l96d03rk.js → 42j6wpibe0zrn.js} +1 -1
- package/dist/app/apps/dashboard/.next/static/chunks/4369o9c3gezxt.js +6 -0
- package/dist/app/apps/dashboard/.next/static/rWpgppq64sqgeZO3-MlD1/_buildManifest.js +11 -0
- package/dist/app/apps/dashboard/package.json +3 -2
- package/dist/app/apps/dashboard/runtime-control-node-credentials.mjs +638 -0
- package/dist/app/apps/dashboard/runtime-embed-isolation.mjs +450 -0
- package/dist/app/apps/dashboard/runtime-environment.mjs +1 -1
- package/dist/app/apps/dashboard/runtime-integrations.mjs +4 -4
- package/dist/app/apps/dashboard/server-tls.mjs +96 -47
- package/dist/app/apps/dashboard/server.js +1 -1
- package/npm-shrinkwrap.json +4 -3
- package/package.json +3 -2
- package/dist/app/apps/dashboard/.next/static/IOi-LmbFghqZcllGm0tny/_buildManifest.js +0 -20
- package/dist/app/apps/dashboard/.next/static/chunks/015s19fe5dtkp.css +0 -2
- package/dist/app/apps/dashboard/.next/static/chunks/06xzeulnw897e.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/07tx3h4lr-lxl.js +0 -6
- package/dist/app/apps/dashboard/.next/static/chunks/0j0dzrd0ev-gx.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/1-pj3rx01kcq0.js +0 -4
- package/dist/app/apps/dashboard/.next/static/chunks/1j5vpju4k1wlj.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/1kjl44-64ume7.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/28zpgt1trm_m4.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/2lk4ailve7631.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/2lulmsr2vjuw5.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/30npcziw-f8ld.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/31hx4x8k9707e.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/34mzv0h7jkx20.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/3cw8xs2dab1g-.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/3gjll_bse9v1f.js +0 -1
- package/dist/app/apps/dashboard/.next/static/chunks/3qq-otw-t-6b0.js +0 -1
- /package/dist/app/apps/dashboard/.next/static/{IOi-LmbFghqZcllGm0tny → rWpgppq64sqgeZO3-MlD1}/_clientMiddlewareManifest.js +0 -0
- /package/dist/app/apps/dashboard/.next/static/{IOi-LmbFghqZcllGm0tny → rWpgppq64sqgeZO3-MlD1}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Control-node credentials at rest (`.magnus/control-nodes.json` in the data directory).
|
|
3
|
+
*
|
|
4
|
+
* Current records are `enc2:` values under CONTROL_NODE_CREDENTIAL_KEY. Records saved before that
|
|
5
|
+
* key existed are `enc:` values under a key derived from JWT_SECRET (or SESSION_SECRET), and very
|
|
6
|
+
* old ones are unencrypted. This module counts both kinds and re-encrypts them under
|
|
7
|
+
* CONTROL_NODE_CREDENTIAL_KEY in one atomic rewrite, after a byte-for-byte backup of the file. The
|
|
8
|
+
* console runs the re-encryption at start; `magnus-ui credentials` reports what remains and
|
|
9
|
+
* `magnus-ui credentials --reencrypt` runs it on demand. Nothing here logs or returns a credential.
|
|
10
|
+
*
|
|
11
|
+
* Every rewrite holds `control-nodes.json.lock`, which the console's store also takes, so a CLI run
|
|
12
|
+
* never overwrites a save made by a running console. A rewrite runs only as the account that owns
|
|
13
|
+
* the file, so the new file and the backup stay readable by the console; `magnus-ui credentials`
|
|
14
|
+
* run as root first drops to that account.
|
|
15
|
+
*/
|
|
16
|
+
import { createCipheriv, createDecipheriv, createHash, randomBytes } from 'node:crypto';
|
|
17
|
+
import {
|
|
18
|
+
closeSync,
|
|
19
|
+
constants,
|
|
20
|
+
fstatSync,
|
|
21
|
+
fsyncSync,
|
|
22
|
+
lstatSync,
|
|
23
|
+
openSync,
|
|
24
|
+
readFileSync,
|
|
25
|
+
renameSync,
|
|
26
|
+
unlinkSync,
|
|
27
|
+
writeFileSync,
|
|
28
|
+
} from 'node:fs';
|
|
29
|
+
import path from 'node:path';
|
|
30
|
+
|
|
31
|
+
const CURRENT_MARKER = 'enc2:';
|
|
32
|
+
const LEGACY_MARKER = 'enc:';
|
|
33
|
+
const CREDENTIAL_FIELDS = ['apiSecret', 'token'];
|
|
34
|
+
/** Fields older releases stored and the console no longer reads; a rewrite drops them. */
|
|
35
|
+
const RETIRED_FIELDS = ['nodeManagerSecret'];
|
|
36
|
+
|
|
37
|
+
/** The control-node state file under a console data directory. */
|
|
38
|
+
export function controlNodeStateFile(root) {
|
|
39
|
+
return path.join(root, '.magnus', 'control-nodes.json');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** `empty`, `current` (enc2:), `legacy` (enc:, JWT_SECRET-derived key) or `plaintext`. */
|
|
43
|
+
export function classifyStoredCredential(value) {
|
|
44
|
+
if (value === undefined || value === null || value === '') return 'empty';
|
|
45
|
+
if (typeof value !== 'string') throw new Error('Control-node state holds a credential that is not a string');
|
|
46
|
+
if (value.startsWith(CURRENT_MARKER)) return 'current';
|
|
47
|
+
if (value.startsWith(LEGACY_MARKER)) return 'legacy';
|
|
48
|
+
return 'plaintext';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function errorCode(error) {
|
|
52
|
+
return error && typeof error === 'object' && 'code' in error ? error.code : undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function isMissing(error) {
|
|
56
|
+
return errorCode(error) === 'ENOENT';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function assertPrivate(metadata, kind) {
|
|
60
|
+
const mode = Number(metadata.mode) & 0o777;
|
|
61
|
+
if (kind === 'directory' && (!metadata.isDirectory() || metadata.isSymbolicLink() || mode !== 0o700)) {
|
|
62
|
+
throw new Error('Control-node state directory must be a non-symlink directory with mode 0700');
|
|
63
|
+
}
|
|
64
|
+
if (kind === 'file' && (!metadata.isFile() || metadata.isSymbolicLink() || mode !== 0o600)) {
|
|
65
|
+
throw new Error('Control-node state must be a regular non-symlink file with mode 0600');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function identity(metadata) {
|
|
70
|
+
return `${metadata.dev}:${metadata.ino}:${metadata.size}:${metadata.mtimeMs}`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Read and parse the state file with the same ownership rules as the console's store; null when absent. */
|
|
74
|
+
function readState(file) {
|
|
75
|
+
try {
|
|
76
|
+
assertPrivate(lstatSync(path.dirname(file)), 'directory');
|
|
77
|
+
} catch (error) {
|
|
78
|
+
if (isMissing(error)) return null;
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
let pathMetadata;
|
|
82
|
+
try {
|
|
83
|
+
pathMetadata = lstatSync(file);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
if (isMissing(error)) return null;
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
assertPrivate(pathMetadata, 'file');
|
|
89
|
+
const descriptor = openSync(file, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
90
|
+
let raw;
|
|
91
|
+
try {
|
|
92
|
+
const opened = fstatSync(descriptor);
|
|
93
|
+
assertPrivate(opened, 'file');
|
|
94
|
+
if (opened.dev !== pathMetadata.dev || opened.ino !== pathMetadata.ino) {
|
|
95
|
+
throw new Error('Control-node state changed while it was being opened');
|
|
96
|
+
}
|
|
97
|
+
raw = readFileSync(descriptor, 'utf8');
|
|
98
|
+
} finally {
|
|
99
|
+
closeSync(descriptor);
|
|
100
|
+
}
|
|
101
|
+
let records;
|
|
102
|
+
try {
|
|
103
|
+
records = JSON.parse(raw);
|
|
104
|
+
} catch {
|
|
105
|
+
throw new Error('Control-node state is not valid JSON');
|
|
106
|
+
}
|
|
107
|
+
if (!Array.isArray(records)) throw new Error('Control-node state must contain an array');
|
|
108
|
+
records.forEach((entry, index) => {
|
|
109
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
110
|
+
throw new Error(`Control-node state entry ${index} is not an object`);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return { raw, records, identity: identity(pathMetadata), owner: { uid: Number(pathMetadata.uid), gid: Number(pathMetadata.gid) } };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function summarize(records) {
|
|
117
|
+
const counts = { nodes: records.length, current: 0, legacy: 0, plaintext: 0, retired: 0 };
|
|
118
|
+
for (const record of records) {
|
|
119
|
+
for (const field of CREDENTIAL_FIELDS) {
|
|
120
|
+
const kind = classifyStoredCredential(record[field]);
|
|
121
|
+
if (kind !== 'empty') counts[kind] += 1;
|
|
122
|
+
}
|
|
123
|
+
for (const field of RETIRED_FIELDS) if (field in record) counts.retired += 1;
|
|
124
|
+
}
|
|
125
|
+
return counts;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Count the stored control-node credentials by key. `legacy` is the number still encrypted under
|
|
130
|
+
* the JWT_SECRET-derived key; `plaintext` the number never encrypted; `retired` the records that
|
|
131
|
+
* still carry a retired field. Throws when the file is unreadable or not private.
|
|
132
|
+
*/
|
|
133
|
+
export function inspectControlNodeCredentials(file) {
|
|
134
|
+
const state = readState(file);
|
|
135
|
+
if (!state) return { present: false, nodes: 0, current: 0, legacy: 0, plaintext: 0, retired: 0 };
|
|
136
|
+
return { present: true, ...summarize(state.records) };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** The uid and gid owning the state file, or null when there is none. */
|
|
140
|
+
export function controlNodeStateOwner(file) {
|
|
141
|
+
try {
|
|
142
|
+
const metadata = lstatSync(file);
|
|
143
|
+
return { uid: Number(metadata.uid), gid: Number(metadata.gid) };
|
|
144
|
+
} catch (error) {
|
|
145
|
+
if (isMissing(error)) return null;
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** True when a rewrite under CONTROL_NODE_CREDENTIAL_KEY is still needed. */
|
|
151
|
+
export function credentialsNeedReencryption(counts) {
|
|
152
|
+
return counts.legacy > 0 || counts.plaintext > 0 || counts.retired > 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ── Cross-process lock shared with the console's control-node store ──────────────────────────────
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* A lock whose holder cannot be identified (another account's unreadable lock) counts as abandoned
|
|
159
|
+
* after this long: a rewrite takes milliseconds. A lock whose holder is a live process never does.
|
|
160
|
+
*/
|
|
161
|
+
const LOCK_STALE_MS = 60_000;
|
|
162
|
+
const LOCK_WAIT_MS = 5_000;
|
|
163
|
+
const LOCK_POLL_MS = 50;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Locks this process holds, by path: the nonce written into the lock file and the number of holders
|
|
167
|
+
* sharing it. Kept on globalThis so every bundled copy of this module in the console shares it.
|
|
168
|
+
* @returns {Map<string, { nonce: string, holders: number }>}
|
|
169
|
+
*/
|
|
170
|
+
function heldLocks() {
|
|
171
|
+
const key = Symbol.for('magnus.controlNodeStateLocks');
|
|
172
|
+
const registry = /** @type {Record<symbol, Map<string, { nonce: string, holders: number }>>} */ (/** @type {unknown} */ (globalThis));
|
|
173
|
+
registry[key] ??= new Map();
|
|
174
|
+
return registry[key];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** The lock file every writer of `file` holds while it reads, changes and replaces it. */
|
|
178
|
+
export function controlNodeStateLockFile(file) {
|
|
179
|
+
return `${file}.lock`;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** The lock's holder (`pid nonce`), or null when there is no lock. `readable` is false for another account's lock. */
|
|
183
|
+
function readLock(lockFile) {
|
|
184
|
+
let metadata;
|
|
185
|
+
try {
|
|
186
|
+
metadata = lstatSync(lockFile);
|
|
187
|
+
} catch (error) {
|
|
188
|
+
if (isMissing(error)) return null;
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
let content = '';
|
|
192
|
+
let readable = true;
|
|
193
|
+
try {
|
|
194
|
+
content = readFileSync(lockFile, 'utf8');
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (isMissing(error)) return null;
|
|
197
|
+
if (errorCode(error) !== 'EACCES') throw error;
|
|
198
|
+
readable = false;
|
|
199
|
+
}
|
|
200
|
+
const [pidText = '', nonce = ''] = content.trim().split(/\s+/);
|
|
201
|
+
const pid = Number.parseInt(pidText, 10);
|
|
202
|
+
return { pid: Number.isInteger(pid) && pid > 0 ? pid : null, nonce: nonce || null, readable, metadata };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function sameLock(a, b) {
|
|
206
|
+
if (!a || !b) return false;
|
|
207
|
+
if (a.nonce && b.nonce) return a.nonce === b.nonce;
|
|
208
|
+
return a.metadata.dev === b.metadata.dev && a.metadata.ino === b.metadata.ino && a.metadata.mtimeMs === b.metadata.mtimeMs;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** True when the lock's holder is gone. Liveness decides; age only when the holder is unknown. */
|
|
212
|
+
function lockIsAbandoned(lock) {
|
|
213
|
+
if (lock.pid !== null) {
|
|
214
|
+
// The same pid without a holder here is a lock left by an earlier process that had our pid.
|
|
215
|
+
if (lock.pid === process.pid) return !heldLocks().has(lock.lockFile);
|
|
216
|
+
try {
|
|
217
|
+
process.kill(lock.pid, 0);
|
|
218
|
+
return false;
|
|
219
|
+
} catch (error) {
|
|
220
|
+
return errorCode(error) === 'ESRCH';
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return Date.now() - lock.metadata.mtimeMs > LOCK_STALE_MS;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Replaceable by tests only, to make the lock write fail. */
|
|
227
|
+
export const lockTestHooks = {
|
|
228
|
+
/** @param {number} descriptor @param {string} text */
|
|
229
|
+
writeLock(descriptor, text) {
|
|
230
|
+
writeFileSync(descriptor, text, 'utf8');
|
|
231
|
+
fsyncSync(descriptor);
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
/** Create the lock with a fresh nonce; returns the nonce, or null when a lock already exists. */
|
|
236
|
+
function createLock(lockFile) {
|
|
237
|
+
const nonce = randomBytes(16).toString('hex');
|
|
238
|
+
let descriptor;
|
|
239
|
+
try {
|
|
240
|
+
descriptor = openSync(lockFile, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (errorCode(error) === 'EEXIST') return null;
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
lockTestHooks.writeLock(descriptor, `${process.pid} ${nonce}\n`);
|
|
247
|
+
} catch (error) {
|
|
248
|
+
// Never leave a half-written lock behind: it would read as held by nobody we can check.
|
|
249
|
+
try { closeSync(descriptor); } catch { /* closing again below is harmless */ }
|
|
250
|
+
descriptor = undefined;
|
|
251
|
+
try { unlinkSync(lockFile); } catch { /* already gone */ }
|
|
252
|
+
throw error;
|
|
253
|
+
} finally {
|
|
254
|
+
if (descriptor !== undefined) closeSync(descriptor);
|
|
255
|
+
}
|
|
256
|
+
return nonce;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function tryAcquireLock(lockFile) {
|
|
260
|
+
const locks = heldLocks();
|
|
261
|
+
const held = locks.get(lockFile);
|
|
262
|
+
if (held) {
|
|
263
|
+
held.holders += 1;
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
let nonce = createLock(lockFile);
|
|
267
|
+
if (nonce === null) {
|
|
268
|
+
const judged = readLock(lockFile);
|
|
269
|
+
// The lock vanished between the two calls: try to create it again, never unlink blindly.
|
|
270
|
+
if (judged !== null) {
|
|
271
|
+
if (!lockIsAbandoned({ ...judged, lockFile })) return false;
|
|
272
|
+
// Take over only the lock judged abandoned, re-read just before unlinking it.
|
|
273
|
+
if (!sameLock(judged, readLock(lockFile))) return false;
|
|
274
|
+
try { unlinkSync(lockFile); } catch (error) { if (!isMissing(error)) throw error; }
|
|
275
|
+
}
|
|
276
|
+
nonce = createLock(lockFile);
|
|
277
|
+
if (nonce === null) return false;
|
|
278
|
+
}
|
|
279
|
+
locks.set(lockFile, { nonce, holders: 1 });
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function releaseLock(lockFile) {
|
|
284
|
+
const locks = heldLocks();
|
|
285
|
+
const held = locks.get(lockFile);
|
|
286
|
+
if (!held) return;
|
|
287
|
+
if (held.holders > 1) {
|
|
288
|
+
held.holders -= 1;
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
locks.delete(lockFile);
|
|
292
|
+
// Remove the lock only while it is still ours (a taken-over lock belongs to someone else now).
|
|
293
|
+
const current = readLock(lockFile);
|
|
294
|
+
if (current?.readable && current.nonce === held.nonce) {
|
|
295
|
+
try { unlinkSync(lockFile); } catch (error) { if (!isMissing(error)) throw error; }
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function lockBusy(lockFile) {
|
|
300
|
+
return new Error(`Control-node state is locked by another process (${path.basename(lockFile)}); nothing was changed, try again`);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Hold the state lock while `fn` runs. Within one process the lock is shared, so nested and
|
|
305
|
+
* concurrent holders in the console do not wait for each other (its own mutex orders them); another
|
|
306
|
+
* process waits up to five seconds, then fails. The state directory must exist.
|
|
307
|
+
* @template T
|
|
308
|
+
* @param {string} file
|
|
309
|
+
* @param {() => Promise<T>} fn
|
|
310
|
+
* @returns {Promise<T>}
|
|
311
|
+
*/
|
|
312
|
+
export async function withControlNodeStateLock(file, fn) {
|
|
313
|
+
const lockFile = controlNodeStateLockFile(file);
|
|
314
|
+
const deadline = Date.now() + LOCK_WAIT_MS;
|
|
315
|
+
while (!tryAcquireLock(lockFile)) {
|
|
316
|
+
if (Date.now() > deadline) throw lockBusy(lockFile);
|
|
317
|
+
await new Promise((resolveWait) => setTimeout(resolveWait, LOCK_POLL_MS));
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
return await fn();
|
|
321
|
+
} finally {
|
|
322
|
+
releaseLock(lockFile);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function withControlNodeStateLockSync(file, fn, waitMs = LOCK_WAIT_MS) {
|
|
327
|
+
const lockFile = controlNodeStateLockFile(file);
|
|
328
|
+
const deadline = Date.now() + waitMs;
|
|
329
|
+
const pause = new Int32Array(new SharedArrayBuffer(4));
|
|
330
|
+
while (!tryAcquireLock(lockFile)) {
|
|
331
|
+
if (Date.now() > deadline) throw lockBusy(lockFile);
|
|
332
|
+
Atomics.wait(pause, 0, 0, LOCK_POLL_MS);
|
|
333
|
+
}
|
|
334
|
+
try {
|
|
335
|
+
return fn();
|
|
336
|
+
} finally {
|
|
337
|
+
releaseLock(lockFile);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function deriveKey(secret) {
|
|
342
|
+
return createHash('sha256').update(secret).digest();
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function dedicatedKey(env) {
|
|
346
|
+
const secret = env['CONTROL_NODE_CREDENTIAL_KEY'] ?? '';
|
|
347
|
+
if (secret.length < 32) throw new Error('CONTROL_NODE_CREDENTIAL_KEY must contain at least 32 characters');
|
|
348
|
+
for (const name of ['API_SECRET', 'SESSION_SECRET', 'JWT_SECRET']) {
|
|
349
|
+
if (env[name] && env[name] === secret) throw new Error(`CONTROL_NODE_CREDENTIAL_KEY must be distinct from ${name}`);
|
|
350
|
+
}
|
|
351
|
+
return deriveKey(secret);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** Every key a legacy `enc:` record may have used: JWT_SECRET first, then SESSION_SECRET. */
|
|
355
|
+
function legacyKeys(env) {
|
|
356
|
+
return [...new Set([env['JWT_SECRET'], env['SESSION_SECRET']].filter((value) => typeof value === 'string' && value !== ''))]
|
|
357
|
+
.map(deriveKey);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function decryptWith(value, marker, key) {
|
|
361
|
+
const parts = value.slice(marker.length).split(':');
|
|
362
|
+
if (parts.length !== 3) throw new Error('Stored control-node credential ciphertext is malformed');
|
|
363
|
+
const [iv, tag, ciphertext] = parts.map((part) => Buffer.from(part, 'base64'));
|
|
364
|
+
if (iv.length !== 12 || tag.length !== 16) throw new Error('Stored control-node credential ciphertext is malformed');
|
|
365
|
+
const decipher = createDecipheriv('aes-256-gcm', key, iv);
|
|
366
|
+
decipher.setAuthTag(tag);
|
|
367
|
+
return Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('utf8');
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function encryptWith(plaintext, key) {
|
|
371
|
+
const iv = randomBytes(12);
|
|
372
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv);
|
|
373
|
+
const ciphertext = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);
|
|
374
|
+
return `${CURRENT_MARKER}${iv.toString('base64')}:${cipher.getAuthTag().toString('base64')}:${ciphertext.toString('base64')}`;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function decryptLegacy(value, keys, label) {
|
|
378
|
+
for (const key of keys) {
|
|
379
|
+
let plaintext;
|
|
380
|
+
try {
|
|
381
|
+
plaintext = decryptWith(value, LEGACY_MARKER, key);
|
|
382
|
+
} catch {
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
if (!plaintext || plaintext.startsWith(LEGACY_MARKER)) break;
|
|
386
|
+
return plaintext;
|
|
387
|
+
}
|
|
388
|
+
throw new Error(`${label} did not decrypt with JWT_SECRET or SESSION_SECRET; set the secret the console used when it was saved`);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function backupName(file, now) {
|
|
392
|
+
const stamp = now.toISOString().replace(/[-:]/g, '').replace(/\.\d{3}Z$/, 'Z');
|
|
393
|
+
return `${file}.legacy-key-backup-${stamp}`;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function syncDirectory(directory) {
|
|
397
|
+
const descriptor = openSync(directory, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
398
|
+
try { fsyncSync(descriptor); } finally { closeSync(descriptor); }
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/** Write `contents` to a new private file; never replaces an existing one. */
|
|
402
|
+
function writeNewPrivateFile(file, contents) {
|
|
403
|
+
const descriptor = openSync(file, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
404
|
+
try {
|
|
405
|
+
writeFileSync(descriptor, contents, 'utf8');
|
|
406
|
+
fsyncSync(descriptor);
|
|
407
|
+
} finally {
|
|
408
|
+
closeSync(descriptor);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
function writeBackup(file, raw, now) {
|
|
413
|
+
const base = backupName(file, now);
|
|
414
|
+
for (const candidate of [base, `${base}-${randomBytes(4).toString('hex')}`]) {
|
|
415
|
+
try {
|
|
416
|
+
writeNewPrivateFile(candidate, raw);
|
|
417
|
+
syncDirectory(path.dirname(file));
|
|
418
|
+
return candidate;
|
|
419
|
+
} catch (error) {
|
|
420
|
+
if (!(error && typeof error === 'object' && 'code' in error && error.code === 'EEXIST')) throw error;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
throw new Error('Could not create a unique control-node state backup');
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Re-encrypt every legacy (`enc:`) and unencrypted control-node credential under
|
|
428
|
+
* CONTROL_NODE_CREDENTIAL_KEY and drop retired fields. Idempotent: a file that needs nothing is
|
|
429
|
+
* left untouched (`status: 'current'`, or `'absent'` when there is no file). Otherwise the original
|
|
430
|
+
* file is first copied to `control-nodes.json.legacy-key-backup-<time>` (mode 0600), every new value
|
|
431
|
+
* is verified by decrypting it again, and the file is replaced atomically; when it changed in the
|
|
432
|
+
* meantime nothing is written. The rewrite holds the state lock shared with the console's store and
|
|
433
|
+
* runs only as the account that owns the file (any other account, root included, is refused, so
|
|
434
|
+
* nothing it writes can end up unreadable by the console or be redirected by that account). Throws, with nothing replaced, when a legacy value
|
|
435
|
+
* cannot be decrypted, when CONTROL_NODE_CREDENTIAL_KEY does not decrypt the values already stored
|
|
436
|
+
* under it, or when the lock stays busy; the console then keeps reading the file as before.
|
|
437
|
+
*
|
|
438
|
+
* @param {string} file
|
|
439
|
+
* @param {Record<string, string | undefined>} [env]
|
|
440
|
+
* @param {{ now?: Date; euid?: number | null; lockWaitMs?: number }} [options]
|
|
441
|
+
* `euid` and `lockWaitMs` exist for tests; they default to the process's and five seconds.
|
|
442
|
+
*/
|
|
443
|
+
export function reencryptLegacyControlNodeCredentials(file, env = process.env, options = {}) {
|
|
444
|
+
const peek = readState(file);
|
|
445
|
+
if (!peek) return { status: 'absent', reencrypted: 0, encrypted: 0, retired: 0, backup: null };
|
|
446
|
+
if (!credentialsNeedReencryption(summarize(peek.records))) {
|
|
447
|
+
return { status: 'current', reencrypted: 0, encrypted: 0, retired: 0, backup: null };
|
|
448
|
+
}
|
|
449
|
+
return withControlNodeStateLockSync(file, () => rewriteUnderLock(file, env, options), options.lockWaitMs);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function rewriteUnderLock(file, env, options) {
|
|
453
|
+
const state = readState(file);
|
|
454
|
+
if (!state) return { status: 'absent', reencrypted: 0, encrypted: 0, retired: 0, backup: null };
|
|
455
|
+
const before = summarize(state.records);
|
|
456
|
+
if (!credentialsNeedReencryption(before)) return { status: 'current', reencrypted: 0, encrypted: 0, retired: 0, backup: null };
|
|
457
|
+
|
|
458
|
+
// The rewrite must stay readable by the account the console runs as, which owns the file.
|
|
459
|
+
const euid = options.euid ?? (typeof process.geteuid === 'function' ? process.geteuid() : null);
|
|
460
|
+
if (euid !== null && euid !== state.owner.uid) {
|
|
461
|
+
throw new Error(`Control-node state belongs to uid ${state.owner.uid}, not this account (uid ${euid}); `
|
|
462
|
+
+ 'run this as the account the console runs as, for example: sudo -u magnus magnus-ui credentials …');
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const key = dedicatedKey(env);
|
|
466
|
+
// A key that does not open what is already stored is not the console's key (an exported variable
|
|
467
|
+
// overrides --env-file); writing under it would lock the console out of every control node.
|
|
468
|
+
for (const [index, record] of state.records.entries()) {
|
|
469
|
+
for (const field of CREDENTIAL_FIELDS) {
|
|
470
|
+
if (classifyStoredCredential(record[field]) !== 'current') continue;
|
|
471
|
+
try {
|
|
472
|
+
decryptWith(record[field], CURRENT_MARKER, key);
|
|
473
|
+
} catch {
|
|
474
|
+
throw new Error(`CONTROL_NODE_CREDENTIAL_KEY does not decrypt control-node entry ${index} ${field}, which is already stored under `
|
|
475
|
+
+ 'the dedicated key; nothing was changed. Use the key the console runs with (a variable exported in the shell overrides --env-file)');
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
const candidates = before.legacy > 0 ? legacyKeys(env) : [];
|
|
480
|
+
if (before.legacy > 0 && candidates.length === 0) {
|
|
481
|
+
throw new Error(`${before.legacy} control-node credential(s) use the legacy key, but neither JWT_SECRET nor SESSION_SECRET is set to decrypt them`);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const next = state.records.map((record, index) => {
|
|
485
|
+
const updated = { ...record };
|
|
486
|
+
for (const field of RETIRED_FIELDS) delete updated[field];
|
|
487
|
+
for (const field of CREDENTIAL_FIELDS) {
|
|
488
|
+
const value = record[field];
|
|
489
|
+
const kind = classifyStoredCredential(value);
|
|
490
|
+
if (kind === 'empty' || kind === 'current') continue;
|
|
491
|
+
const label = `Control-node entry ${index} ${field}`;
|
|
492
|
+
const plaintext = kind === 'legacy' ? decryptLegacy(value, candidates, label) : value;
|
|
493
|
+
const encrypted = encryptWith(plaintext, key);
|
|
494
|
+
if (decryptWith(encrypted, CURRENT_MARKER, key) !== plaintext) throw new Error(`${label} failed round-trip verification`);
|
|
495
|
+
updated[field] = encrypted;
|
|
496
|
+
}
|
|
497
|
+
return updated;
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
const backup = writeBackup(file, state.raw, options.now ?? new Date());
|
|
501
|
+
const directory = path.dirname(file);
|
|
502
|
+
const temporary = path.join(directory, `.control-nodes.${process.pid}.${randomBytes(12).toString('hex')}.tmp`);
|
|
503
|
+
let temporaryExists = false;
|
|
504
|
+
try {
|
|
505
|
+
writeNewPrivateFile(temporary, `${JSON.stringify(next, null, 2)}\n`);
|
|
506
|
+
temporaryExists = true;
|
|
507
|
+
const current = lstatSync(file);
|
|
508
|
+
assertPrivate(current, 'file');
|
|
509
|
+
if (identity(current) !== state.identity) {
|
|
510
|
+
throw new Error('Control-node state changed while it was being re-encrypted; nothing was replaced, run it again');
|
|
511
|
+
}
|
|
512
|
+
renameSync(temporary, file);
|
|
513
|
+
temporaryExists = false;
|
|
514
|
+
syncDirectory(directory);
|
|
515
|
+
} finally {
|
|
516
|
+
if (temporaryExists) {
|
|
517
|
+
try { unlinkSync(temporary); } catch { /* already gone */ }
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
const after = inspectControlNodeCredentials(file);
|
|
522
|
+
if (credentialsNeedReencryption(after)) throw new Error('Control-node state still holds legacy credentials after re-encryption');
|
|
523
|
+
return { status: 'reencrypted', reencrypted: before.legacy, encrypted: before.plaintext, retired: before.retired, backup };
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function entryLabel(record, index) {
|
|
527
|
+
const id = typeof record.id === 'string' && record.id ? record.id : '?';
|
|
528
|
+
const name = typeof record.name === 'string' && record.name && record.name !== id ? ` "${record.name}"` : '';
|
|
529
|
+
return `entry ${index} (${id}${name})`;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* The hard gate before Magnus 4, which reads control-node credentials only under
|
|
534
|
+
* CONTROL_NODE_CREDENTIAL_KEY: decrypt every stored credential with that key and list each one that
|
|
535
|
+
* does not open with it (`legacy`: still under the JWT_SECRET-derived key; `plaintext`: never
|
|
536
|
+
* encrypted; `undecryptable`: an `enc2:` value the key does not open, or a malformed one) and every
|
|
537
|
+
* retired field still on disk. `ok` is true only when the file exists and every credential in it
|
|
538
|
+
* decrypts under the key. For a legacy value, `reencryptable` says whether JWT_SECRET or
|
|
539
|
+
* SESSION_SECRET opens it, so `--reencrypt` can migrate it. Read-only; never returns or logs a value.
|
|
540
|
+
* Throws when the file is unreadable or not private, or when the key is missing or invalid.
|
|
541
|
+
*
|
|
542
|
+
* @param {string} file
|
|
543
|
+
* @param {Record<string, string | undefined>} [env]
|
|
544
|
+
*/
|
|
545
|
+
export function verifyControlNodeCredentials(file, env = process.env) {
|
|
546
|
+
const state = readState(file);
|
|
547
|
+
if (!state) return { present: false, ok: false, nodes: 0, checked: 0, verified: 0, problems: [] };
|
|
548
|
+
const key = dedicatedKey(env);
|
|
549
|
+
const legacy = legacyKeys(env);
|
|
550
|
+
const problems = [];
|
|
551
|
+
let checked = 0;
|
|
552
|
+
let verified = 0;
|
|
553
|
+
state.records.forEach((record, index) => {
|
|
554
|
+
const entry = entryLabel(record, index);
|
|
555
|
+
for (const field of RETIRED_FIELDS) {
|
|
556
|
+
if (field in record) problems.push({ index, entry, field, kind: 'retired' });
|
|
557
|
+
}
|
|
558
|
+
for (const field of CREDENTIAL_FIELDS) {
|
|
559
|
+
let kind;
|
|
560
|
+
try {
|
|
561
|
+
kind = classifyStoredCredential(record[field]);
|
|
562
|
+
} catch {
|
|
563
|
+
problems.push({ index, entry, field, kind: 'undecryptable' });
|
|
564
|
+
checked += 1;
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
if (kind === 'empty') continue;
|
|
568
|
+
checked += 1;
|
|
569
|
+
if (kind === 'current') {
|
|
570
|
+
let plaintext = '';
|
|
571
|
+
try {
|
|
572
|
+
plaintext = decryptWith(record[field], CURRENT_MARKER, key);
|
|
573
|
+
} catch {
|
|
574
|
+
// Reported below.
|
|
575
|
+
}
|
|
576
|
+
if (plaintext && !plaintext.startsWith(LEGACY_MARKER) && !plaintext.startsWith(CURRENT_MARKER)) verified += 1;
|
|
577
|
+
else problems.push({ index, entry, field, kind: 'undecryptable' });
|
|
578
|
+
} else if (kind === 'legacy') {
|
|
579
|
+
let reencryptable = false;
|
|
580
|
+
try {
|
|
581
|
+
decryptLegacy(record[field], legacy, entry);
|
|
582
|
+
reencryptable = true;
|
|
583
|
+
} catch {
|
|
584
|
+
// Not with the secrets in this environment.
|
|
585
|
+
}
|
|
586
|
+
problems.push({ index, entry, field, kind, reencryptable });
|
|
587
|
+
} else {
|
|
588
|
+
problems.push({ index, entry, field, kind });
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
return { present: true, ok: problems.length === 0, nodes: state.records.length, checked, verified, problems };
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/** The lines `magnus-ui credentials --check` prints for a verification result. Never includes a value. */
|
|
596
|
+
export function describeCredentialVerification(result, file) {
|
|
597
|
+
if (!result.present) return [`control-node credentials: no state file at ${file} (nothing is stored there; check --data-dir)`];
|
|
598
|
+
if (result.ok) {
|
|
599
|
+
return [`control-node credentials check passed: all ${result.checked} credential(s) of ${result.nodes} control node(s) in ${file} `
|
|
600
|
+
+ 'decrypt under CONTROL_NODE_CREDENTIAL_KEY; none remain under the legacy JWT_SECRET-derived key'];
|
|
601
|
+
}
|
|
602
|
+
const lines = [`control-node credentials check FAILED for ${file}: ${result.verified} of ${result.checked} credential(s) decrypt under `
|
|
603
|
+
+ `CONTROL_NODE_CREDENTIAL_KEY; ${result.problems.length} problem(s):`];
|
|
604
|
+
for (const problem of result.problems) {
|
|
605
|
+
const reason = {
|
|
606
|
+
legacy: `under the legacy JWT_SECRET-derived key (${problem.reencryptable
|
|
607
|
+
? '`--reencrypt` can migrate it'
|
|
608
|
+
: 'JWT_SECRET and SESSION_SECRET in this environment do not open it; set the secret the console used when it was saved, or re-add this node'})`,
|
|
609
|
+
plaintext: 'not encrypted',
|
|
610
|
+
undecryptable: 'does not decrypt under CONTROL_NODE_CREDENTIAL_KEY (wrong key, or a corrupt value; re-add this node if the key is right)',
|
|
611
|
+
retired: 'retired field still stored in plain text',
|
|
612
|
+
}[problem.kind];
|
|
613
|
+
lines.push(` - ${problem.entry} ${problem.field}: ${reason}`);
|
|
614
|
+
}
|
|
615
|
+
return lines;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/** One log line for a re-encryption result, or null when nothing changed. Never includes a value. */
|
|
619
|
+
export function describeReencryption(result) {
|
|
620
|
+
if (result.status !== 'reencrypted') return null;
|
|
621
|
+
const parts = [];
|
|
622
|
+
if (result.reencrypted) parts.push(`${result.reencrypted} from the legacy JWT_SECRET-derived key`);
|
|
623
|
+
if (result.encrypted) parts.push(`${result.encrypted} that were not encrypted`);
|
|
624
|
+
if (result.retired) parts.push(`dropped ${result.retired} retired node-manager secret(s)`);
|
|
625
|
+
return `re-encrypted control-node credentials under CONTROL_NODE_CREDENTIAL_KEY (${parts.join('; ')}); the previous file is kept at ${result.backup}`;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/** One summary line for `magnus-ui credentials`; with `file`, it names the file it describes. */
|
|
629
|
+
export function describeCredentialCounts(counts, file) {
|
|
630
|
+
if (!counts.present) {
|
|
631
|
+
return file
|
|
632
|
+
? `control-node credentials: no state file at ${file} (nothing is stored there; check --data-dir)`
|
|
633
|
+
: 'control-node credentials: no state file';
|
|
634
|
+
}
|
|
635
|
+
const line = `control-node credentials${file ? ` in ${file}` : ''}: ${counts.current} under CONTROL_NODE_CREDENTIAL_KEY, `
|
|
636
|
+
+ `${counts.legacy} under the legacy JWT_SECRET-derived key, ${counts.plaintext} not encrypted`;
|
|
637
|
+
return counts.retired ? `${line}, ${counts.retired} retired node-manager secret(s)` : line;
|
|
638
|
+
}
|