@camstack/server 1.2.942 → 1.2.943

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.943] - 2026-11-23
11
+
12
+ ### Fixed
13
+
14
+ - A camera added with a password no longer keeps it in plain text in the device settings: the first registration moves it into the keychain
15
+
10
16
  ## [1.2.942] - 2026-11-22
11
17
 
12
18
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.942",
3
+ "version": "1.2.943",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,23 +66,9 @@
66
66
  ],
67
67
  "requires": {
68
68
  "addons": {
69
- "@camstack/addon-admin-ui": ">=1.2.738",
70
- "@camstack/addon-agent-ui": ">=1.2.436",
71
- "@camstack/addon-benchmark": ">=1.2.316",
72
- "@camstack/addon-export-alexa": ">=1.2.206",
73
- "@camstack/addon-matter-broker": ">=0.2.174",
74
- "@camstack/addon-model-studio": ">=1.1.348",
75
- "@camstack/addon-osd-manager": ">=0.1.322",
76
- "@camstack/addon-pipeline": ">=1.2.682",
77
- "@camstack/addon-pipeline-orchestrator": ">=1.2.717",
78
- "@camstack/addon-post-analysis": ">=1.2.723",
79
- "@camstack/addon-provider-dreame": ">=0.2.183",
80
- "@camstack/addon-provider-gree": ">=0.2.166",
81
- "@camstack/addon-provider-homeassistant": ">=1.2.701",
82
- "@camstack/addon-provider-homematic": ">=1.2.213",
83
- "@camstack/addon-provider-kia": ">=0.1.1",
84
- "@camstack/addon-provider-unifi": ">=0.2.175",
85
- "@camstack/addon-training": ">=0.1.141"
69
+ "@camstack/addon-pipeline-orchestrator": ">=1.2.718",
70
+ "@camstack/addon-post-analysis": ">=1.2.724",
71
+ "@camstack/addon-provider-reolink": ">=1.2.260"
86
72
  },
87
73
  "wrapper": {
88
74
  "desktop": ">=0.0.1",
@@ -98,9 +84,9 @@
98
84
  "@camstack/addon-decoder-nodeav": "1.2.150",
99
85
  "@camstack/addon-notifiers": "1.2.642",
100
86
  "@camstack/addon-pipeline": "1.2.682",
101
- "@camstack/addon-pipeline-orchestrator": "1.2.717",
102
- "@camstack/addon-post-analysis": "1.2.723",
103
- "@camstack/develop": "0.1.57",
87
+ "@camstack/addon-pipeline-orchestrator": "1.2.718",
88
+ "@camstack/addon-post-analysis": "1.2.724",
89
+ "@camstack/develop": "0.1.58",
104
90
  "@camstack/sdk": "1.2.160",
105
91
  "@camstack/types": "1.2.626",
106
92
  "@camstack/ui-library": "1.2.499",
@@ -38,3 +38,17 @@ export declare function loadDeviceConfigWithSecrets(ctx: AddonContext, input: {
38
38
  readonly ownerAddonId: string;
39
39
  readonly stored: Record<string, unknown>;
40
40
  }): Promise<Record<string, unknown>>;
41
+ /**
42
+ * The CREATE write reaches the door before the device class exists, so the
43
+ * paths its schema declares secret are not known yet and the blob lands raw.
44
+ * The first registration brings those paths: move every declared TOP-LEVEL
45
+ * secret still raw (a non-empty string, not a marker) into the keychain.
46
+ * Only the first registration of a row — this completes the create write; a
47
+ * re-registration of an older row converts nothing (no silent migration).
48
+ * Returns the converted path names (never values).
49
+ */
50
+ export declare function secureRawDeclaredSecrets(deps: DeviceConfigSecretDeps, input: {
51
+ readonly deviceId: number;
52
+ readonly ownerAddonId: string;
53
+ readonly secretPaths: readonly string[];
54
+ }): Promise<readonly string[]>;
@@ -18610,6 +18610,34 @@ async function loadDeviceConfigWithSecrets(ctx, input) {
18610
18610
  });
18611
18611
  return value;
18612
18612
  }
18613
+ /**
18614
+ * The CREATE write reaches the door before the device class exists, so the
18615
+ * paths its schema declares secret are not known yet and the blob lands raw.
18616
+ * The first registration brings those paths: move every declared TOP-LEVEL
18617
+ * secret still raw (a non-empty string, not a marker) into the keychain.
18618
+ * Only the first registration of a row — this completes the create write; a
18619
+ * re-registration of an older row converts nothing (no silent migration).
18620
+ * Returns the converted path names (never values).
18621
+ */
18622
+ async function secureRawDeclaredSecrets(deps, input) {
18623
+ if (ownerSecrets(deps.ctx, input.ownerAddonId) === null) return [];
18624
+ const stored = await deps.readStored();
18625
+ const rawKeys = input.secretPaths.filter((path) => {
18626
+ if (path.includes(".") || path.includes("[")) return false;
18627
+ const value = stored[path];
18628
+ return typeof value === "string" && value.length > 0;
18629
+ });
18630
+ if (rawKeys.length === 0) return [];
18631
+ const patch = Object.fromEntries(rawKeys.map((key) => [key, stored[key]]));
18632
+ await persistDeviceConfigWithSecrets(deps, {
18633
+ deviceId: input.deviceId,
18634
+ ownerAddonId: input.ownerAddonId,
18635
+ data: patch,
18636
+ secretPaths: rawKeys,
18637
+ operatorWrite: true
18638
+ });
18639
+ return rawKeys;
18640
+ }
18613
18641
  //#endregion
18614
18642
  //#region src/builtins/device-manager/device-removal-hooks.ts
18615
18643
  /**
@@ -19844,6 +19872,27 @@ async function registerDevice(pctx, input) {
19844
19872
  }
19845
19873
  });
19846
19874
  }
19875
+ const declaredSecretPaths = input.secretConfigPaths ?? [];
19876
+ if (isFirstRegistration && declaredSecretPaths.length > 0) try {
19877
+ const converted = await secureRawDeclaredSecrets({
19878
+ ctx: pctx.host.ctx,
19879
+ readStored: () => pctx.settings.readDeviceStore(id),
19880
+ write: (patch) => pctx.settings.writeDeviceStore(id, patch)
19881
+ }, {
19882
+ deviceId: id,
19883
+ ownerAddonId: addonId,
19884
+ secretPaths: declaredSecretPaths
19885
+ });
19886
+ if (converted.length > 0) pctx.host.ctx.logger.info("registerDevice: secured raw secret fields from the create write", {
19887
+ tags: { deviceId: id },
19888
+ meta: { paths: [...converted] }
19889
+ });
19890
+ } catch (err) {
19891
+ pctx.host.ctx.logger.warn("registerDevice: could not secure raw secret fields from the create write", {
19892
+ tags: { deviceId: id },
19893
+ meta: { error: err instanceof Error ? err.message : String(err) }
19894
+ });
19895
+ }
19847
19896
  if (isFirstRegistration) pctx.host.ctx.eventBus.emit({
19848
19897
  id: (0, node_crypto.randomUUID)(),
19849
19898
  timestamp: /* @__PURE__ */ new Date(),
@@ -18604,6 +18604,34 @@ async function loadDeviceConfigWithSecrets(ctx, input) {
18604
18604
  });
18605
18605
  return value;
18606
18606
  }
18607
+ /**
18608
+ * The CREATE write reaches the door before the device class exists, so the
18609
+ * paths its schema declares secret are not known yet and the blob lands raw.
18610
+ * The first registration brings those paths: move every declared TOP-LEVEL
18611
+ * secret still raw (a non-empty string, not a marker) into the keychain.
18612
+ * Only the first registration of a row — this completes the create write; a
18613
+ * re-registration of an older row converts nothing (no silent migration).
18614
+ * Returns the converted path names (never values).
18615
+ */
18616
+ async function secureRawDeclaredSecrets(deps, input) {
18617
+ if (ownerSecrets(deps.ctx, input.ownerAddonId) === null) return [];
18618
+ const stored = await deps.readStored();
18619
+ const rawKeys = input.secretPaths.filter((path) => {
18620
+ if (path.includes(".") || path.includes("[")) return false;
18621
+ const value = stored[path];
18622
+ return typeof value === "string" && value.length > 0;
18623
+ });
18624
+ if (rawKeys.length === 0) return [];
18625
+ const patch = Object.fromEntries(rawKeys.map((key) => [key, stored[key]]));
18626
+ await persistDeviceConfigWithSecrets(deps, {
18627
+ deviceId: input.deviceId,
18628
+ ownerAddonId: input.ownerAddonId,
18629
+ data: patch,
18630
+ secretPaths: rawKeys,
18631
+ operatorWrite: true
18632
+ });
18633
+ return rawKeys;
18634
+ }
18607
18635
  //#endregion
18608
18636
  //#region src/builtins/device-manager/device-removal-hooks.ts
18609
18637
  /**
@@ -19838,6 +19866,27 @@ async function registerDevice(pctx, input) {
19838
19866
  }
19839
19867
  });
19840
19868
  }
19869
+ const declaredSecretPaths = input.secretConfigPaths ?? [];
19870
+ if (isFirstRegistration && declaredSecretPaths.length > 0) try {
19871
+ const converted = await secureRawDeclaredSecrets({
19872
+ ctx: pctx.host.ctx,
19873
+ readStored: () => pctx.settings.readDeviceStore(id),
19874
+ write: (patch) => pctx.settings.writeDeviceStore(id, patch)
19875
+ }, {
19876
+ deviceId: id,
19877
+ ownerAddonId: addonId,
19878
+ secretPaths: declaredSecretPaths
19879
+ });
19880
+ if (converted.length > 0) pctx.host.ctx.logger.info("registerDevice: secured raw secret fields from the create write", {
19881
+ tags: { deviceId: id },
19882
+ meta: { paths: [...converted] }
19883
+ });
19884
+ } catch (err) {
19885
+ pctx.host.ctx.logger.warn("registerDevice: could not secure raw secret fields from the create write", {
19886
+ tags: { deviceId: id },
19887
+ meta: { error: err instanceof Error ? err.message : String(err) }
19888
+ });
19889
+ }
19841
19890
  if (isFirstRegistration) pctx.host.ctx.eventBus.emit({
19842
19891
  id: randomUUID(),
19843
19892
  timestamp: /* @__PURE__ */ new Date(),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.942",
3
+ "version": "1.2.943",
4
4
  "description": "CamStack builtins — shipped inside @camstack/server (generated, do not edit)",
5
5
  "license": "MIT",
6
6
  "camstack": {