@camstack/system 1.2.378 → 1.2.380
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/assets/addon-pages-aggregator/icon.svg +5 -0
- package/assets/addon-widgets-aggregator/icon.svg +6 -0
- package/assets/alert-center/icon.svg +5 -0
- package/assets/autotrack/icon.svg +5 -0
- package/assets/backup-orchestrator/icon.svg +5 -0
- package/assets/calendars/icon.svg +5 -0
- package/assets/camera-grid/icon.svg +10 -0
- package/assets/composer/icon.svg +7 -0
- package/assets/console-logging/icon.svg +4 -0
- package/assets/core-blocks/icon.svg +6 -0
- package/assets/device-manager/icon.svg +6 -0
- package/assets/filesystem-storage/icon.svg +6 -0
- package/assets/hub-forwarder/icon.svg +7 -0
- package/assets/keychain/icon.svg +6 -0
- package/assets/liveness-monitor/icon.svg +4 -0
- package/assets/local-auth/icon.svg +5 -0
- package/assets/local-network/icon.svg +7 -0
- package/assets/loki-logging/icon.svg +7 -0
- package/assets/metrics-native/icon.svg +3 -0
- package/assets/platform-probe/icon.svg +5 -0
- package/assets/remote-access-orchestrator/icon.svg +5 -0
- package/assets/snapshot/icon.svg +4 -0
- package/assets/sqlite-settings/icon.svg +5 -0
- package/assets/storage-orchestrator/icon.svg +8 -0
- package/assets/system-config/icon.svg +4 -0
- package/assets/winston-logging/icon.svg +6 -0
- package/dist/addon-runner.js +1 -1
- package/dist/addon-runner.mjs +1 -1
- package/dist/addon-utils.js +1 -1
- package/dist/addon-utils.mjs +1 -1
- package/dist/auth/auth-manager.d.ts +10 -2
- package/dist/auth/jwt-signing-key.d.ts +42 -0
- package/dist/auth/user-manager.d.ts +19 -19
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +34 -4
- package/dist/builtins/keychain/index.mjs +34 -4
- package/dist/builtins/keychain/keychain-service.d.ts +14 -2
- package/dist/builtins/keychain/system-held-secrets.d.ts +11 -0
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/admin-account-boot.d.ts +1 -1
- package/dist/builtins/local-auth/auth-config-reader.d.ts +9 -7
- package/dist/builtins/local-auth/jwt-signing-key-keeper.d.ts +30 -0
- package/dist/builtins/local-auth/local-auth.addon.d.ts +2 -6
- package/dist/builtins/local-auth/local-auth.addon.js +127 -221
- package/dist/builtins/local-auth/local-auth.addon.mjs +126 -220
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/dist/builtins/system-config/cluster-secret-keeper.d.ts +36 -0
- package/dist/builtins/system-config/system-config.addon.d.ts +13 -0
- package/dist/builtins/system-config/system-config.addon.js +244 -53
- package/dist/builtins/system-config/system-config.addon.mjs +244 -54
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{child-cap-dispatch-C9lmrWFT.js → child-cap-dispatch-CZeRUgYF.js} +1 -1
- package/dist/{child-cap-dispatch-DpHovtQd.mjs → child-cap-dispatch-CpjohToR.mjs} +1 -1
- package/dist/cluster-secret-BDue-uJj.mjs +83 -0
- package/dist/cluster-secret-Dg0OOOSr.js +148 -0
- package/dist/{composition-sources-CxhGdtdh.js → composition-sources-CHvLMrFI.js} +1 -1
- package/dist/{composition-sources-BLBd338N.mjs → composition-sources-DT_uJwI3.mjs} +1 -1
- package/dist/{dist-Bvl5JgNt.mjs → dist-B9oFw2jh.mjs} +58 -2
- package/dist/{dist-KxsOMQik.js → dist-Cc6KOdY-.js} +69 -1
- package/dist/{event-loop-stall-monitor-D8rqSWfW.mjs → event-loop-stall-monitor-anUH2IE1.mjs} +14 -14
- package/dist/{event-loop-stall-monitor-CbSmCWkp.js → event-loop-stall-monitor-mk6WGxir.js} +14 -14
- package/dist/index.d.ts +4 -2
- package/dist/index.js +192 -62
- package/dist/index.mjs +171 -55
- package/dist/jwt-signing-key-C2rE3wH6.js +174 -0
- package/dist/jwt-signing-key-Qhde8r82.mjs +127 -0
- package/dist/kernel/config-manager.d.ts +1 -1
- package/dist/kernel/config-schema.d.ts +4 -11
- package/dist/kernel/index.d.ts +2 -1
- package/dist/kernel/moleculer/broker-factory.d.ts +0 -2
- package/dist/kernel/moleculer/cluster-secret.d.ts +31 -0
- package/dist/kernel/moleculer/hub-service.d.ts +7 -4
- package/dist/kernel/moleculer/node-registry.d.ts +1 -1
- package/dist/kernel/system-settings-policy.d.ts +7 -9
- package/dist/{retired-settings-keys-BAcfvFtm.mjs → retired-settings-keys-DlZ3VV6x.mjs} +1 -1
- package/dist/{retired-settings-keys-gTsZfpmP.js → retired-settings-keys-YOOKLA3v.js} +1 -1
- package/package.json +55 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("./dist-
|
|
3
|
+
const require_dist = require("./dist-Cc6KOdY-.js");
|
|
4
|
+
const require_jwt_signing_key = require("./jwt-signing-key-C2rE3wH6.js");
|
|
4
5
|
const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
|
|
5
6
|
require("./builtins/alerts/index.js");
|
|
6
7
|
const require_builtins_calendars_calendars_addon = require("./builtins/calendars/calendars.addon.js");
|
|
@@ -26,12 +27,13 @@ const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage
|
|
|
26
27
|
const require_hub_cap_forward = require("./hub-cap-forward-COCmYaup.js");
|
|
27
28
|
const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
|
|
28
29
|
require("./builtins/storage-orchestrator/index.js");
|
|
30
|
+
const require_cluster_secret = require("./cluster-secret-Dg0OOOSr.js");
|
|
29
31
|
const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
|
|
30
32
|
require("./builtins/system-config/index.js");
|
|
31
33
|
const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
|
|
32
|
-
const require_event_loop_stall_monitor = require("./event-loop-stall-monitor-
|
|
34
|
+
const require_event_loop_stall_monitor = require("./event-loop-stall-monitor-mk6WGxir.js");
|
|
33
35
|
const require_tls$1 = require("./tls-CCMX7MjX.js");
|
|
34
|
-
const require_child_cap_dispatch = require("./child-cap-dispatch-
|
|
36
|
+
const require_child_cap_dispatch = require("./child-cap-dispatch-CZeRUgYF.js");
|
|
35
37
|
const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
|
|
36
38
|
const require_resource_monitor = require("./resource-monitor-BgWGRxN5.js");
|
|
37
39
|
const require_custom_action_registry = require("./custom-action-registry-acBY3mHA.js");
|
|
@@ -7769,6 +7771,157 @@ function createDoorSettingsView(addonId, door, sections) {
|
|
|
7769
7771
|
};
|
|
7770
7772
|
}
|
|
7771
7773
|
//#endregion
|
|
7774
|
+
//#region src/kernel/config-schema.ts
|
|
7775
|
+
/** Default data directory — used when CAMSTACK_DATA env var is not set */
|
|
7776
|
+
var DEFAULT_DATA_PATH = "camstack-data";
|
|
7777
|
+
/**
|
|
7778
|
+
* A list of browser origins from config.yaml (a YAML list) or from the
|
|
7779
|
+
* `CAMSTACK_CORS_ORIGINS` env var (one comma-separated string — env carries
|
|
7780
|
+
* only strings). Validation of each entry is the CORS policy's job
|
|
7781
|
+
* (`server/backend/src/api/cors/cors-policy.ts`), which logs what it rejects;
|
|
7782
|
+
* the schema only fixes the SHAPE so a typo cannot stop the hub from booting.
|
|
7783
|
+
*/
|
|
7784
|
+
var originListSchema = zod.z.preprocess((value) => typeof value === "string" ? value.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0) : value, zod.z.array(zod.z.string()));
|
|
7785
|
+
var serverSchema = zod.z.object({
|
|
7786
|
+
port: zod.z.number().default(4443),
|
|
7787
|
+
host: zod.z.string().default("0.0.0.0"),
|
|
7788
|
+
dataPath: zod.z.string().default(DEFAULT_DATA_PATH),
|
|
7789
|
+
/**
|
|
7790
|
+
* EXTRA browser origins allowed to call this hub cross-origin (D707), on
|
|
7791
|
+
* top of the built-ins: the hub's own origin, the hosted viewer PWA and the
|
|
7792
|
+
* native app's opaque `null` origin. Bootstrap-owned on purpose — widening
|
|
7793
|
+
* who may read hub responses in a browser is a security decision, and the
|
|
7794
|
+
* policy is live from the first request, before the settings store exists.
|
|
7795
|
+
*/
|
|
7796
|
+
corsOrigins: originListSchema.default([])
|
|
7797
|
+
});
|
|
7798
|
+
/**
|
|
7799
|
+
* The bootstrap `auth` section holds NO credential (D797): the session signing
|
|
7800
|
+
* key lives in the keychain, and a fresh hub seeds `admin` / `changeme`
|
|
7801
|
+
* (`FIRST_BOOT_ADMIN_*`). The retired keys `jwtSecret`, `adminUsername` and
|
|
7802
|
+
* `adminPassword` are stripped when a legacy config.yaml still carries them —
|
|
7803
|
+
* the boot warns so the operator removes them (the one-off ops script imports
|
|
7804
|
+
* a `jwtSecret` into the keychain first).
|
|
7805
|
+
*/
|
|
7806
|
+
var authSchema = zod.z.object({});
|
|
7807
|
+
var hubSchema = zod.z.object({
|
|
7808
|
+
url: zod.z.string().default("ws://localhost:4443/agent"),
|
|
7809
|
+
token: zod.z.string().default("")
|
|
7810
|
+
});
|
|
7811
|
+
var agentSchema = zod.z.object({
|
|
7812
|
+
name: zod.z.string().default(""),
|
|
7813
|
+
/** Port for the agent status page (minimal HTML) */
|
|
7814
|
+
statusPort: zod.z.number().default(4444)
|
|
7815
|
+
});
|
|
7816
|
+
var tlsSchema = zod.z.object({
|
|
7817
|
+
/**
|
|
7818
|
+
* Enable HTTPS (default: true). The certificate itself is never configured
|
|
7819
|
+
* here: the admin UI (Network → Local access) generates or uploads it
|
|
7820
|
+
* (D726), and boot serves whatever `tls/mode` says.
|
|
7821
|
+
*/
|
|
7822
|
+
enabled: zod.z.boolean().default(true) });
|
|
7823
|
+
/**
|
|
7824
|
+
* Bootstrap-time addon configuration — read PURELY from YAML, before the
|
|
7825
|
+
* kernel can talk to the settings-store. This breaks the chicken-and-egg
|
|
7826
|
+
* where the settings store itself is implemented by an addon: the kernel
|
|
7827
|
+
* needs to know WHICH addon to load first to provide the store, and that
|
|
7828
|
+
* decision can't itself live in the store.
|
|
7829
|
+
*
|
|
7830
|
+
* Backward-compatible: every field is optional + defaults reproduce the
|
|
7831
|
+
* current hard-coded behavior. Existing config.yaml files keep working.
|
|
7832
|
+
*/
|
|
7833
|
+
var bootstrapAddonsSchema = zod.z.object({
|
|
7834
|
+
/**
|
|
7835
|
+
* Addon implementing the `settings-store` capability. Loaded FIRST,
|
|
7836
|
+
* before any other addon is enabled — every other addon's enable
|
|
7837
|
+
* state, settings, and ordering lives in the store it provides.
|
|
7838
|
+
*
|
|
7839
|
+
* Default: '@camstack/addon-sqlite-storage' (the workspace's
|
|
7840
|
+
* default SQLite-backed store). Future alternatives could swap this
|
|
7841
|
+
* for postgres/redis without touching kernel code.
|
|
7842
|
+
*/
|
|
7843
|
+
settingsStoreAddon: zod.z.string().default("@camstack/addon-sqlite-storage"),
|
|
7844
|
+
/**
|
|
7845
|
+
* How the launcher provisions REQUIRED_PACKAGES into `data/addons/`
|
|
7846
|
+
* on startup.
|
|
7847
|
+
*
|
|
7848
|
+
* - `'npm'` — pull from the npm registry (production default).
|
|
7849
|
+
* - `'local'` — copy `packages/<X>/` from the workspace into
|
|
7850
|
+
* `data/addons/<X>/`. Use for the Electron-
|
|
7851
|
+
* packaged bundle and the e2e harness.
|
|
7852
|
+
* - `'symlink'` — point `data/addons/<X>` at the workspace source
|
|
7853
|
+
* dir via a directory symlink. Dev-only: a
|
|
7854
|
+
* workspace rebuild (`npm run build -w <X>`) is
|
|
7855
|
+
* immediately reflected at the next addon load,
|
|
7856
|
+
* no copy step. Falls back to `'local'` on
|
|
7857
|
+
* platforms that reject symlink creation (Windows
|
|
7858
|
+
* without developer-mode).
|
|
7859
|
+
*
|
|
7860
|
+
* The `CAMSTACK_INSTALL_SOURCE` env var, when set, wins over this
|
|
7861
|
+
* field. Leave undefined to keep the launcher's default behaviour
|
|
7862
|
+
* (npm when no workspace, local when a bundled addons dir is
|
|
7863
|
+
* present, …).
|
|
7864
|
+
*/
|
|
7865
|
+
installSource: zod.z.enum([
|
|
7866
|
+
"npm",
|
|
7867
|
+
"local",
|
|
7868
|
+
"symlink"
|
|
7869
|
+
]).optional(),
|
|
7870
|
+
/**
|
|
7871
|
+
* Override the kernel's hard-coded `AddonInstaller.REQUIRED_PACKAGES`.
|
|
7872
|
+
* Passing an array here REPLACES the default list entirely — useful
|
|
7873
|
+
* for stripped-down deployments (only the bundle of addons the
|
|
7874
|
+
* operator actually wants) and for forcing a different storage
|
|
7875
|
+
* backend at first boot.
|
|
7876
|
+
*
|
|
7877
|
+
* Leave undefined to use the kernel-shipped defaults.
|
|
7878
|
+
*/
|
|
7879
|
+
requiredAddons: zod.z.array(zod.z.string()).optional(),
|
|
7880
|
+
/**
|
|
7881
|
+
* Disable list applied AFTER the settings-store reports the enabled
|
|
7882
|
+
* set. Operator escape hatch — boot without a known-broken addon
|
|
7883
|
+
* without having to mutate the store.
|
|
7884
|
+
*/
|
|
7885
|
+
forceDisable: zod.z.array(zod.z.string()).default([])
|
|
7886
|
+
});
|
|
7887
|
+
/**
|
|
7888
|
+
* Where the keychain's master key lives (D788). config.yaml ONLY: no env var
|
|
7889
|
+
* maps here, and the settings store may not answer it
|
|
7890
|
+
* (`BOOTSTRAP_OWNED_SECTIONS`). Absent → the desktop OS keychain when the hub
|
|
7891
|
+
* runs inside the desktop app, else `<dataDir>/.keychain/master.key`.
|
|
7892
|
+
*/
|
|
7893
|
+
var keychainSchema = zod.z.object({
|
|
7894
|
+
/** A file holding 32 random bytes, base64 (or hex). Keep it OFF the data volume. */
|
|
7895
|
+
keyFile: zod.z.string().min(1).optional(),
|
|
7896
|
+
/**
|
|
7897
|
+
* The key being rotated away from — consulted only to UNLOCK, so a move to a
|
|
7898
|
+
* new key file is: new file, old one here, restart, rotate, remove this.
|
|
7899
|
+
*/
|
|
7900
|
+
previousKeyFile: zod.z.string().min(1).optional()
|
|
7901
|
+
});
|
|
7902
|
+
/** Bootstrap config -- loaded from config.yaml ONLY at startup.
|
|
7903
|
+
* All other settings live in SQL (system_settings table). */
|
|
7904
|
+
var bootstrapSchema = zod.z.object({
|
|
7905
|
+
/** Server mode: 'hub' (full server) or 'agent' (worker node) */
|
|
7906
|
+
mode: zod.z.enum(["hub", "agent"]).default("hub"),
|
|
7907
|
+
server: serverSchema.default(serverSchema.parse({})),
|
|
7908
|
+
auth: authSchema.default(authSchema.parse({})),
|
|
7909
|
+
/** Hub connection config — only used when mode='agent' */
|
|
7910
|
+
hub: hubSchema.default(hubSchema.parse({})),
|
|
7911
|
+
/** Agent-specific config — only used when mode='agent' */
|
|
7912
|
+
agent: agentSchema.default(agentSchema.parse({})),
|
|
7913
|
+
/** TLS configuration */
|
|
7914
|
+
tls: tlsSchema.default(tlsSchema.parse({})),
|
|
7915
|
+
/**
|
|
7916
|
+
* Addon bootstrap directives — minimum addon set needed before the
|
|
7917
|
+
* kernel can reach the settings-store. See bootstrapAddonsSchema.
|
|
7918
|
+
* Spec: docs/superpowers/specs/2026-05-15-yaml-bootstrap-expansion.md
|
|
7919
|
+
*/
|
|
7920
|
+
bootstrap: bootstrapAddonsSchema.default(bootstrapAddonsSchema.parse({})),
|
|
7921
|
+
/** Keychain master-key location (config.yaml only). */
|
|
7922
|
+
keychain: keychainSchema.default({})
|
|
7923
|
+
});
|
|
7924
|
+
//#endregion
|
|
7772
7925
|
//#region ../../node_modules/js-yaml/dist/js-yaml.mjs
|
|
7773
7926
|
/*! js-yaml 4.2.0 https://github.com/nodeca/js-yaml @license MIT */
|
|
7774
7927
|
var __create = Object.create;
|
|
@@ -10123,15 +10276,12 @@ var ENV_VAR_MAP = {
|
|
|
10123
10276
|
CAMSTACK_PORT: "server.port",
|
|
10124
10277
|
CAMSTACK_HOST: "server.host",
|
|
10125
10278
|
CAMSTACK_DATA: "server.dataPath",
|
|
10126
|
-
CAMSTACK_JWT_SECRET: "auth.jwtSecret",
|
|
10127
|
-
CAMSTACK_ADMIN_USER: "auth.adminUsername",
|
|
10128
|
-
CAMSTACK_ADMIN_PASS: "auth.adminPassword",
|
|
10129
10279
|
CAMSTACK_CORS_ORIGINS: "server.corsOrigins"
|
|
10130
10280
|
};
|
|
10131
10281
|
/** config.yaml, env overrides applied, parsed. */
|
|
10132
10282
|
function loadBootstrapConfig(configPath) {
|
|
10133
10283
|
const merged = applyEnvOverrides((0, _camstack_types_addon.asJsonObject)(loadYaml(configPath)) ?? {});
|
|
10134
|
-
return
|
|
10284
|
+
return bootstrapSchema.parse(merged);
|
|
10135
10285
|
}
|
|
10136
10286
|
function writeBootstrapSection(configPath, section, data) {
|
|
10137
10287
|
if (!BOOTSTRAP_SECTIONS.has(section)) throw new Error(`[ConfigManager] Section "${section}" is a runtime setting — use setSection() to persist via the settings-store, not update() which writes to config.yaml`);
|
|
@@ -10142,7 +10292,7 @@ function writeBootstrapSection(configPath, section, data) {
|
|
|
10142
10292
|
...existing,
|
|
10143
10293
|
...data
|
|
10144
10294
|
};
|
|
10145
|
-
const validation =
|
|
10295
|
+
const validation = bootstrapSchema.safeParse(raw);
|
|
10146
10296
|
if (!validation.success) throw new Error(`[ConfigManager] Invalid config update for section "${section}": ${validation.error.message}`);
|
|
10147
10297
|
const tmpPath = `${configPath}.tmp`;
|
|
10148
10298
|
node_fs.writeFileSync(tmpPath, dump(raw, {
|
|
@@ -10315,16 +10465,14 @@ function createStoreSettingsView(addonId, cm) {
|
|
|
10315
10465
|
* Which `system-settings` keys the STORE may answer, and which the kernel
|
|
10316
10466
|
* loads from the door into memory at boot — D675.
|
|
10317
10467
|
*
|
|
10318
|
-
* ## The store never
|
|
10468
|
+
* ## The store never answers for a bootstrap section
|
|
10319
10469
|
*
|
|
10320
|
-
* `system-settings`
|
|
10321
|
-
* `auth.
|
|
10322
|
-
*
|
|
10323
|
-
*
|
|
10324
|
-
*
|
|
10325
|
-
*
|
|
10326
|
-
* in "highest priority" would let a stale DB copy replace the JWT secret —
|
|
10327
|
-
* invalidating every token — and change the login password.
|
|
10470
|
+
* `system-settings` may still hold `auth.jwtSecret`, `auth.adminUsername` and
|
|
10471
|
+
* `auth.adminPassword` — written there by `local-auth` (and by older builds)
|
|
10472
|
+
* next to `auth.tokenExpiry`. Since D797 none of the three is a setting at
|
|
10473
|
+
* all (the signing key is the keychain's, the first-boot admin is fixed), and
|
|
10474
|
+
* the stale rows must still never answer: merging them back in would let a
|
|
10475
|
+
* stale DB copy stand in for a credential. The one-off ops script deletes them.
|
|
10328
10476
|
*
|
|
10329
10477
|
* So a bootstrap-owned section is answered from env + config.yaml ONLY, and
|
|
10330
10478
|
* the store may add exactly the keys in {@link STORE_READABLE_BOOTSTRAP_KEYS}:
|
|
@@ -10583,7 +10731,7 @@ var ConfigManager = class {
|
|
|
10583
10731
|
* implementation (sqlite, redis, in-memory, …) behaves identically here.
|
|
10584
10732
|
*
|
|
10585
10733
|
* D675: a bootstrap-owned section takes ONLY allow-listed keys from the
|
|
10586
|
-
* store (a stored `auth.jwtSecret` never
|
|
10734
|
+
* store (a stale stored `auth.jwtSecret` never answers), and with only the
|
|
10587
10735
|
* door wired this sync read THROWS — the settings view's `getSection` reads
|
|
10588
10736
|
* the door.
|
|
10589
10737
|
*/
|
|
@@ -94272,7 +94420,7 @@ function resolveUseHostname() {
|
|
|
94272
94420
|
return process.env["CAMSTACK_MOLECULER_USE_HOSTNAME"] !== "false";
|
|
94273
94421
|
}
|
|
94274
94422
|
function createBroker(config) {
|
|
94275
|
-
const { nodeID, mode, hubAddress, logLevel = "warn",
|
|
94423
|
+
const { nodeID, mode, hubAddress, logLevel = "warn", tcpPort = DEFAULT_HUB_TCP_PORT, udpPort = DEFAULT_UDP_PORT } = config;
|
|
94276
94424
|
const useHostname = resolveUseHostname();
|
|
94277
94425
|
const infraLevel = "error";
|
|
94278
94426
|
const wildcardLevel = logLevel;
|
|
@@ -94294,7 +94442,6 @@ function createBroker(config) {
|
|
|
94294
94442
|
};
|
|
94295
94443
|
if (mode === "hub") return new ServiceBroker({
|
|
94296
94444
|
nodeID,
|
|
94297
|
-
namespace: secret || void 0,
|
|
94298
94445
|
serializer: "MsgPack",
|
|
94299
94446
|
transporter: {
|
|
94300
94447
|
type: "TCP",
|
|
@@ -94337,7 +94484,6 @@ function createBroker(config) {
|
|
|
94337
94484
|
}
|
|
94338
94485
|
return new ServiceBroker({
|
|
94339
94486
|
nodeID,
|
|
94340
|
-
namespace: secret || void 0,
|
|
94341
94487
|
serializer: "MsgPack",
|
|
94342
94488
|
transporter: {
|
|
94343
94489
|
type: "TCP",
|
|
@@ -94495,38 +94641,6 @@ var HubLogForwarder = class {
|
|
|
94495
94641
|
}
|
|
94496
94642
|
};
|
|
94497
94643
|
//#endregion
|
|
94498
|
-
//#region src/kernel/moleculer/cluster-secret.ts
|
|
94499
|
-
/**
|
|
94500
|
-
* Cluster-secret registration gate (opt-in). A registering node sends a
|
|
94501
|
-
* SHA-256 hash of its `CAMSTACK_CLUSTER_SECRET`; the receiver of a
|
|
94502
|
-
* `registerNode` RPC verifies it. The raw secret is never transmitted.
|
|
94503
|
-
*/
|
|
94504
|
-
/** Moleculer error `type` marking a registration rejected for a bad cluster secret. */
|
|
94505
|
-
var CLUSTER_SECRET_MISMATCH_TYPE = "CLUSTER_SECRET_MISMATCH";
|
|
94506
|
-
/** Process exit code a runner uses when its registration is rejected for a bad secret. */
|
|
94507
|
-
var CLUSTER_SECRET_REJECTED_EXIT_CODE = 78;
|
|
94508
|
-
/** SHA-256 hex digest of a cluster secret. Never transmit or log the raw secret. */
|
|
94509
|
-
function hashClusterSecret(secret) {
|
|
94510
|
-
return (0, node_crypto.createHash)("sha256").update(secret, "utf8").digest("hex");
|
|
94511
|
-
}
|
|
94512
|
-
/**
|
|
94513
|
-
* True if a registration carrying `presentedHash` is allowed against a
|
|
94514
|
-
* receiver whose own secret hashes to `expectedHash`.
|
|
94515
|
-
* - `expectedHash` undefined → the gate is OFF; everything is allowed.
|
|
94516
|
-
* - otherwise `presentedHash` must be present and equal (constant-time).
|
|
94517
|
-
*/
|
|
94518
|
-
function clusterSecretMatches(expectedHash, presentedHash) {
|
|
94519
|
-
if (expectedHash === void 0) return true;
|
|
94520
|
-
if (presentedHash === void 0 || presentedHash.length !== expectedHash.length) return false;
|
|
94521
|
-
return (0, node_crypto.timingSafeEqual)(Buffer.from(expectedHash), Buffer.from(presentedHash));
|
|
94522
|
-
}
|
|
94523
|
-
/** Recognises a cluster-secret rejection, including after a Moleculer RPC round-trip. */
|
|
94524
|
-
function isClusterSecretMismatchError(err) {
|
|
94525
|
-
if (typeof err !== "object" || err === null || !("type" in err)) return false;
|
|
94526
|
-
const { type } = err;
|
|
94527
|
-
return type === CLUSTER_SECRET_MISMATCH_TYPE;
|
|
94528
|
-
}
|
|
94529
|
-
//#endregion
|
|
94530
94644
|
//#region src/kernel/moleculer/hub-service.ts
|
|
94531
94645
|
function createHubService(deps) {
|
|
94532
94646
|
return {
|
|
@@ -94550,7 +94664,9 @@ function createHubService(deps) {
|
|
|
94550
94664
|
return true;
|
|
94551
94665
|
} },
|
|
94552
94666
|
registerNode: { handler(ctx) {
|
|
94553
|
-
|
|
94667
|
+
const verdict = require_cluster_secret.checkClusterSecret(deps.clusterSecretGate?.() ?? { kind: "off" }, ctx.params.clusterSecretHash);
|
|
94668
|
+
if (verdict === "mismatch") throw new Errors.MoleculerError(`cluster secret mismatch — node "${ctx.params.nodeId}" rejected`, 403, require_cluster_secret.CLUSTER_SECRET_MISMATCH_TYPE);
|
|
94669
|
+
if (verdict === "unavailable") throw new Errors.MoleculerRetryableError(`the hub cannot read its cluster secret yet — node "${ctx.params.nodeId}" must retry`, 503, require_cluster_secret.CLUSTER_SECRET_UNAVAILABLE_TYPE);
|
|
94554
94670
|
deps.onRegisterNode?.(ctx.params);
|
|
94555
94671
|
return { ok: true };
|
|
94556
94672
|
} },
|
|
@@ -94754,7 +94870,7 @@ async function callRegisterNodeWithRetry(broker, params, opts) {
|
|
|
94754
94870
|
if (attempt > 0) opts.log?.(`[register-node] ${action} acked after ${attempt + 1} attempt(s)`);
|
|
94755
94871
|
return;
|
|
94756
94872
|
} catch (err) {
|
|
94757
|
-
if (isClusterSecretMismatchError(err)) {
|
|
94873
|
+
if (require_cluster_secret.isClusterSecretMismatchError(err)) {
|
|
94758
94874
|
opts.log?.(`[register-node] ${action} REJECTED — cluster secret mismatch; not retrying`);
|
|
94759
94875
|
throw err;
|
|
94760
94876
|
}
|
|
@@ -96347,8 +96463,11 @@ exports.CAP_ACTION_UNLABELLED = require_child_cap_dispatch.CAP_ACTION_UNLABELLED
|
|
|
96347
96463
|
exports.CAP_METHOD_NOT_IMPLEMENTED = require_child_cap_dispatch.CAP_METHOD_NOT_IMPLEMENTED;
|
|
96348
96464
|
exports.CA_COMMON_NAME = require_tls$1.CA_COMMON_NAME;
|
|
96349
96465
|
exports.CA_VALIDITY_DAYS = require_tls$1.CA_VALIDITY_DAYS;
|
|
96350
|
-
exports.CLUSTER_SECRET_MISMATCH_TYPE = CLUSTER_SECRET_MISMATCH_TYPE;
|
|
96351
|
-
exports.
|
|
96466
|
+
exports.CLUSTER_SECRET_MISMATCH_TYPE = require_cluster_secret.CLUSTER_SECRET_MISMATCH_TYPE;
|
|
96467
|
+
exports.CLUSTER_SECRET_REF = require_cluster_secret.CLUSTER_SECRET_REF;
|
|
96468
|
+
exports.CLUSTER_SECRET_REJECTED_EXIT_CODE = require_cluster_secret.CLUSTER_SECRET_REJECTED_EXIT_CODE;
|
|
96469
|
+
exports.CLUSTER_SECRET_SETTINGS_KEY = require_cluster_secret.CLUSTER_SECRET_SETTINGS_KEY;
|
|
96470
|
+
exports.CLUSTER_SECRET_UNAVAILABLE_TYPE = require_cluster_secret.CLUSTER_SECRET_UNAVAILABLE_TYPE;
|
|
96352
96471
|
exports.CORE_CAP_SERVICE_NAME = CORE_CAP_SERVICE_NAME;
|
|
96353
96472
|
exports.CalendarsAddon = require_builtins_calendars_calendars_addon.CalendarsAddon;
|
|
96354
96473
|
exports.CapRouteError = require_child_cap_dispatch.CapRouteError;
|
|
@@ -96365,7 +96484,7 @@ exports.ConsoleLoggingAddon = require_builtins_console_logging_index.ConsoleLogg
|
|
|
96365
96484
|
exports.CoreBlocksAddon = require_builtins_core_blocks_core_blocks_addon.CoreBlocksAddon;
|
|
96366
96485
|
exports.CustomActionRegistry = require_custom_action_registry.CustomActionRegistry;
|
|
96367
96486
|
exports.DECISIVE_HEAP_SPACES = require_child_cap_dispatch.DECISIVE_HEAP_SPACES;
|
|
96368
|
-
exports.DEFAULT_DATA_PATH =
|
|
96487
|
+
exports.DEFAULT_DATA_PATH = DEFAULT_DATA_PATH;
|
|
96369
96488
|
exports.DEFAULT_LAN_HTTP_PORT = require_tls$1.DEFAULT_LAN_HTTP_PORT;
|
|
96370
96489
|
exports.DEFAULT_LOG_LEVEL = DEFAULT_LOG_LEVEL;
|
|
96371
96490
|
exports.DEVICE_SETTINGS_CONTRIBUTION_METHODS = require_dist.DEVICE_SETTINGS_CONTRIBUTION_METHODS;
|
|
@@ -96381,6 +96500,8 @@ exports.EVENT_PLANE_TOP_N = require_child_cap_dispatch.EVENT_PLANE_TOP_N;
|
|
|
96381
96500
|
exports.EVENT_TOPIC_PREFIX = require_child_cap_dispatch.EVENT_TOPIC_PREFIX;
|
|
96382
96501
|
exports.EngineManagerResolver = EngineManagerResolver;
|
|
96383
96502
|
exports.EventBus = EventBus;
|
|
96503
|
+
exports.FIRST_BOOT_ADMIN_PASSWORD = require_builtins_local_auth_local_auth_addon.FIRST_BOOT_ADMIN_PASSWORD;
|
|
96504
|
+
exports.FIRST_BOOT_ADMIN_USERNAME = require_builtins_local_auth_local_auth_addon.FIRST_BOOT_ADMIN_USERNAME;
|
|
96384
96505
|
exports.FeatureManager = FeatureManager;
|
|
96385
96506
|
exports.FilesystemStorageAddon = require_builtins_sqlite_storage_filesystem_storage_addon.FilesystemStorageAddon;
|
|
96386
96507
|
exports.FilesystemStorageProvider = require_builtins_sqlite_storage_filesystem_storage_addon.FilesystemStorageProvider;
|
|
@@ -96407,7 +96528,9 @@ exports.HubLogForwarder = HubLogForwarder;
|
|
|
96407
96528
|
exports.HubNodeRegistry = HubNodeRegistry;
|
|
96408
96529
|
exports.INFRA_CAPABILITIES = INFRA_CAPABILITIES;
|
|
96409
96530
|
exports.IntegrationRegistry = IntegrationRegistry;
|
|
96531
|
+
exports.JWT_SIGNING_KEY_REF = require_jwt_signing_key.JWT_SIGNING_KEY_REF;
|
|
96410
96532
|
exports.JobJournal = JobJournal;
|
|
96533
|
+
exports.JwtSigningKeyUnavailableError = require_jwt_signing_key.JwtSigningKeyUnavailableError;
|
|
96411
96534
|
exports.LEAF_RENEWAL_WINDOW_DAYS = require_tls$1.LEAF_RENEWAL_WINDOW_DAYS;
|
|
96412
96535
|
exports.LifecycleJobEngine = LifecycleJobEngine;
|
|
96413
96536
|
exports.LifecycleStateMachine = LifecycleStateMachine;
|
|
@@ -96462,6 +96585,7 @@ exports.SOCKET_QUEUE_TOP_N = require_child_cap_dispatch.SOCKET_QUEUE_TOP_N;
|
|
|
96462
96585
|
exports.STALL_REPORT_MS = require_event_loop_stall_monitor.STALL_REPORT_MS;
|
|
96463
96586
|
exports.STALL_TICK_MS = require_event_loop_stall_monitor.STALL_TICK_MS;
|
|
96464
96587
|
exports.STORE_READABLE_BOOTSTRAP_KEYS = STORE_READABLE_BOOTSTRAP_KEYS;
|
|
96588
|
+
exports.SYSTEM_SECRET_OWNER = require_jwt_signing_key.SYSTEM_SECRET_OWNER;
|
|
96465
96589
|
exports.ScopedLogger = ScopedLogger;
|
|
96466
96590
|
exports.ScopedTokenManager = require_builtins_local_auth_local_auth_addon.ScopedTokenManager;
|
|
96467
96591
|
exports.SettingsReadUnavailableError = require_builtins_local_auth_local_auth_addon.SettingsReadUnavailableError;
|
|
@@ -96498,7 +96622,7 @@ exports.applyCertificateToListener = require_tls$1.applyCertificateToListener;
|
|
|
96498
96622
|
exports.applyLanHttp = require_tls$1.applyLanHttp;
|
|
96499
96623
|
exports.attributeStall = require_event_loop_stall_monitor.attributeStall;
|
|
96500
96624
|
exports.bindPendingLanHttp = require_tls$1.bindPendingLanHttp;
|
|
96501
|
-
exports.bootstrapSchema =
|
|
96625
|
+
exports.bootstrapSchema = bootstrapSchema;
|
|
96502
96626
|
exports.brokerCallForCap = require_child_cap_dispatch.brokerCallForCap;
|
|
96503
96627
|
exports.brokerTransportLink = require_child_cap_dispatch.brokerTransportLink;
|
|
96504
96628
|
Object.defineProperty(exports, "buildBinaryPath", {
|
|
@@ -96523,6 +96647,7 @@ exports.capActionName = require_child_cap_dispatch.capActionName;
|
|
|
96523
96647
|
exports.capActionSuffix = require_child_cap_dispatch.capActionSuffix;
|
|
96524
96648
|
exports.capBareAction = require_child_cap_dispatch.capBareAction;
|
|
96525
96649
|
exports.capServiceName = require_child_cap_dispatch.capServiceName;
|
|
96650
|
+
exports.checkClusterSecret = require_cluster_secret.checkClusterSecret;
|
|
96526
96651
|
exports.classifyAddonDir = classifyAddonDir;
|
|
96527
96652
|
exports.classifyCapRoute = require_child_cap_dispatch.classifyCapRoute;
|
|
96528
96653
|
exports.clearHttpsListener = require_tls$1.clearHttpsListener;
|
|
@@ -96530,7 +96655,7 @@ exports.clearPendingRestart = clearPendingRestart;
|
|
|
96530
96655
|
exports.clearPlatformKeychainKey = require_platform_key_source.clearPlatformKeychainKey;
|
|
96531
96656
|
exports.closeLanHttp = require_tls$1.closeLanHttp;
|
|
96532
96657
|
exports.clusterEventTopic = require_child_cap_dispatch.clusterEventTopic;
|
|
96533
|
-
exports.clusterSecretMatches = clusterSecretMatches;
|
|
96658
|
+
exports.clusterSecretMatches = require_cluster_secret.clusterSecretMatches;
|
|
96534
96659
|
exports.collectCertIdentity = require_tls$1.collectCertIdentity;
|
|
96535
96660
|
exports.collectModelFiles = require_event_loop_stall_monitor.collectModelFiles;
|
|
96536
96661
|
exports.contentTypeFor = require_event_loop_stall_monitor.contentTypeFor;
|
|
@@ -96656,6 +96781,8 @@ Object.defineProperty(exports, "getPlatformInfo", {
|
|
|
96656
96781
|
}
|
|
96657
96782
|
});
|
|
96658
96783
|
exports.getPlatformKeychainKey = require_platform_key_source.getPlatformKeychainKey;
|
|
96784
|
+
exports.getProcessClusterSecretGate = require_cluster_secret.getProcessClusterSecretGate;
|
|
96785
|
+
exports.getProcessJwtSigningKeyState = require_jwt_signing_key.getProcessJwtSigningKeyState;
|
|
96659
96786
|
Object.defineProperty(exports, "getPythonDownloadUrl", {
|
|
96660
96787
|
enumerable: true,
|
|
96661
96788
|
get: function() {
|
|
@@ -96666,7 +96793,7 @@ exports.getRestartMarkerPath = getRestartMarkerPath;
|
|
|
96666
96793
|
exports.getSinglePidStats = require_resource_monitor.getSinglePidStats;
|
|
96667
96794
|
exports.getWorkerDeviceRegistry = require_child_cap_dispatch.getWorkerDeviceRegistry;
|
|
96668
96795
|
exports.hasDotNode = hasDotNode;
|
|
96669
|
-
exports.hashClusterSecret = hashClusterSecret;
|
|
96796
|
+
exports.hashClusterSecret = require_cluster_secret.hashClusterSecret;
|
|
96670
96797
|
exports.heapSpaceField = require_child_cap_dispatch.heapSpaceField;
|
|
96671
96798
|
exports.hostNodeIdOf = require_child_cap_dispatch.hostNodeIdOf;
|
|
96672
96799
|
exports.hubMainRssBudget = require_child_cap_dispatch.hubMainRssBudget;
|
|
@@ -96690,7 +96817,7 @@ exports.ipcParentLink = require_child_cap_dispatch.ipcParentLink;
|
|
|
96690
96817
|
exports.isAddonDeploySource = isAddonDeploySource;
|
|
96691
96818
|
exports.isArrayBufferCensusReport = require_child_cap_dispatch.isArrayBufferCensusReport;
|
|
96692
96819
|
exports.isArrayOutputSchema = require_dist.isArrayOutputSchema;
|
|
96693
|
-
exports.isClusterSecretMismatchError = isClusterSecretMismatchError;
|
|
96820
|
+
exports.isClusterSecretMismatchError = require_cluster_secret.isClusterSecretMismatchError;
|
|
96694
96821
|
exports.isCollectionArrayMethod = require_dist.isCollectionArrayMethod;
|
|
96695
96822
|
exports.isCredentialKeyName = require_child_cap_dispatch.isCredentialKeyName;
|
|
96696
96823
|
exports.isInfraCapability = isInfraCapability;
|
|
@@ -96711,6 +96838,7 @@ exports.parseRssBudgetMb = require_child_cap_dispatch.parseRssBudgetMb;
|
|
|
96711
96838
|
exports.parseTokenizedUrl = require_event_loop_stall_monitor.parseTokenizedUrl;
|
|
96712
96839
|
exports.partitionIsolatedBuiltinIds = partitionIsolatedBuiltinIds;
|
|
96713
96840
|
exports.prepareBootTls = require_tls$1.prepareBootTls;
|
|
96841
|
+
exports.processJwtSigningKey = require_jwt_signing_key.processJwtSigningKey;
|
|
96714
96842
|
exports.proxyToUpstream = proxyToUpstream;
|
|
96715
96843
|
exports.quarantineAddonResidue = quarantineAddonResidue;
|
|
96716
96844
|
exports.readExtraSans = require_tls$1.readExtraSans;
|
|
@@ -96752,6 +96880,7 @@ exports.servedHttpsLeafFingerprint = require_tls$1.servedHttpsLeafFingerprint;
|
|
|
96752
96880
|
exports.setHubConnected = require_child_cap_dispatch.setHubConnected;
|
|
96753
96881
|
exports.setNodeEventInterest = require_child_cap_dispatch.setNodeEventInterest;
|
|
96754
96882
|
exports.setPlatformKeychainKey = require_platform_key_source.setPlatformKeychainKey;
|
|
96883
|
+
exports.setProcessClusterSecretGate = require_cluster_secret.setProcessClusterSecretGate;
|
|
96755
96884
|
exports.setWrapperActive = require_builtins_device_manager_device_manager_addon.setWrapperActive;
|
|
96756
96885
|
exports.shouldReclaim = require_child_cap_dispatch.shouldReclaim;
|
|
96757
96886
|
exports.signalAllRunnerGroups = require_child_cap_dispatch.signalAllRunnerGroups;
|
|
@@ -96762,6 +96891,7 @@ exports.stampCallerAddonId = require_child_cap_dispatch.stampCallerAddonId;
|
|
|
96762
96891
|
exports.startEventLoopStallMonitor = require_event_loop_stall_monitor.startEventLoopStallMonitor;
|
|
96763
96892
|
exports.startHeapWatch = require_child_cap_dispatch.startHeapWatch;
|
|
96764
96893
|
exports.startRunnerHeapWatch = require_child_cap_dispatch.startRunnerHeapWatch;
|
|
96894
|
+
exports.staticJwtSigningKey = require_jwt_signing_key.staticJwtSigningKey;
|
|
96765
96895
|
exports.storeMayAnswer = storeMayAnswer;
|
|
96766
96896
|
exports.storeUploadedCertificate = require_tls$1.storeUploadedCertificate;
|
|
96767
96897
|
exports.strandedMb = require_child_cap_dispatch.strandedMb;
|