From 5579a788e323976f3fad63a5ccdde348703a9a0d Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Fri, 26 Apr 2024 19:04:08 +0200 Subject: [PATCH] Fix `forbidWs` option being ignored (#1790) * Fix `forbidWs` option being ignored * PR link --- wasm-node/CHANGELOG.md | 4 ++++ wasm-node/javascript/src/internals/local-instance.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wasm-node/CHANGELOG.md b/wasm-node/CHANGELOG.md index 4ffd2ffdea..65c038fdd9 100644 --- a/wasm-node/CHANGELOG.md +++ b/wasm-node/CHANGELOG.md @@ -6,6 +6,10 @@ - All `transactionWatch_unstable`-prefixed JSON-RPC functions have been renamed to `transactionWatch_v1`, in accordance with the latest changes in the JSON-RPC API specification. ([#1771](https://github.com/smol-dot/smoldot/pull/1771)) +### Fixed + +- Fix the `forbidWs` option being ignored when connecting to non-localhost addresses. Smoldot erroneously only took the value of `forbidNonLocalWs` in that situation. Connecting to a non-localhost address is now only done if both `forbidWs` and `forbidNonLocalWs` are `false`. ([#1790](https://github.com/smol-dot/smoldot/pull/1790)) + ## 2.0.24 - 2024-04-16 ### Changed diff --git a/wasm-node/javascript/src/internals/local-instance.ts b/wasm-node/javascript/src/internals/local-instance.ts index 0a0287b5b6..1b601bb93f 100644 --- a/wasm-node/javascript/src/internals/local-instance.ts +++ b/wasm-node/javascript/src/internals/local-instance.ts @@ -283,7 +283,7 @@ export async function startLocalInstance(config: Config, wasmModule: WebAssembly case 4: case 5: case 6: { - return config.forbidNonLocalWs ? 0 : 1 + return (config.forbidWs || config.forbidNonLocalWs) ? 0 : 1 } case 7: { return config.forbidWs ? 0 : 1