@effectstream/midnight-contracts 0.103.2 → 0.103.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effectstream/midnight-contracts",
3
- "version": "0.103.2",
3
+ "version": "0.103.3",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "homepage": "https://effectstream.github.io/docs/",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "./types": "./src/types.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@effectstream/utils": "0.103.2",
24
+ "@effectstream/utils": "0.103.3",
25
25
  "@scure/bip39": "^2.0.1",
26
26
  "dotenv": "^16.4.7",
27
27
  "rxjs": "^7.8.2",
package/src/dust-state.ts CHANGED
@@ -19,10 +19,17 @@ const log = console;
19
19
  * Uses first 16 hex chars of the seed as a stable identifier — the seed
20
20
  * deterministically maps to a dust address, so this is a unique key per wallet
21
21
  * that is available before building the facade.
22
+ *
23
+ * `networkId` is stripped to a safe character set before it reaches
24
+ * `path.join`. No caller currently passes untrusted input here (`networkId`
25
+ * comes from the wallet SDK's own enum or a local CLI env var), but nothing
26
+ * upstream enforces that, and a `networkId` containing `../` would otherwise
27
+ * let the resulting path escape `baseDir`.
22
28
  */
23
29
  export function getDustStatePath(baseDir: string, networkId: string, seed: string): string {
24
30
  const seedKey = seed.slice(0, 16);
25
- return path.join(baseDir, `${networkId}-${seedKey}.json`);
31
+ const safeNetworkId = networkId.replace(/[^a-zA-Z0-9_-]/g, "_");
32
+ return path.join(baseDir, `${safeNetworkId}-${seedKey}.json`);
26
33
  }
27
34
 
28
35
  function isUndeployedNetwork(networkId: string): boolean {