From e75af7d9b4eaa8028da8dc8543d3b7935486f0b8 Mon Sep 17 00:00:00 2001 From: Vanya Agnesandra Date: Wed, 30 Aug 2023 13:07:48 -0400 Subject: [PATCH] Redact usernames and user project structure from wasm panic messages --- veilid-wasm/wasm_build.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/veilid-wasm/wasm_build.sh b/veilid-wasm/wasm_build.sh index c38f8bff..7a6bb0f5 100755 --- a/veilid-wasm/wasm_build.sh +++ b/veilid-wasm/wasm_build.sh @@ -26,6 +26,15 @@ if [[ "$1" == "release" ]]; then OUTPUTDIR=../target/wasm32-unknown-unknown/release/pkg INPUTDIR=../target/wasm32-unknown-unknown/release + # Path to, but not including, the cargo workspace ("veilid") + WORKSPACE_PARENT=$(dirname $(dirname $(cargo locate-project --workspace --message-format=plain))) + # Do not include said path in wasm blob output + RUSTFLAGS="--remap-path-prefix=$WORKSPACE_PARENT=/home/user $RUSTFLAGS" + # Do not include user home directory in wasm blob output + RUSTFLAGS="--remap-path-prefix=$HOME=/home/user $RUSTFLAGS" + # Explicitly mark RUSTFLAGS as an environment variable, so it's passed to cargo + export RUSTFLAGS + cargo build --target wasm32-unknown-unknown --release mkdir -p $OUTPUTDIR wasm-bindgen --out-dir $OUTPUTDIR --target web $INPUTDIR/veilid_wasm.wasm