Compare commits

...

3 Commits

Author SHA1 Message Date
Jonas Kruckenberg
586d702a40 Create cli.remap-path-prefix.md 2023-03-24 13:05:15 +01:00
Jonas Kruckenberg
020efa4dfa fmt 2023-03-24 13:03:15 +01:00
Jonas Kruckenberg
cc63794c91 fix: strip potential PII from release binaries
This sets rusts `--remap-path-prefix` flags to strip potential PII from release binaries by truncating absolute paths from panic messages and debug symbols.

closes: #6538
2023-03-24 13:02:23 +01:00
2 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"cli.rs": "patch"
---
Configure the rust compiler to truncate absolute paths in panic messages and debug symbols when building in release mode. This prevents a possible leak of PII through absolute paths.

View File

@@ -308,6 +308,25 @@ fn build_command(
build_cmd.arg("build");
build_cmd.args(args);
// set the rust --remap-path-prefix flags to strip absolute paths that could leak usernames or other PII from panic messages and debug symbols
// see https://github.com/tauri-apps/tauri/issues/6538 for context
let mut rustflags = std::env::var("RUSTFLAGS").unwrap_or_default();
rustflags.push_str(&format!(
" --remap-path-prefix={}=",
std::env::current_dir().unwrap().display()
));
rustflags.push_str(&format!(
" --remap-path-prefix={}=cargo",
env!("CARGO_HOME")
));
rustflags.push_str(&format!(
" --remap-path-prefix={}=rustup",
env!("RUSTUP_HOME")
));
build_cmd.envs([("RUSTFLAGS", rustflags)]);
Ok(build_cmd)
}