diff --git a/.changes/validate-isolation-hook-set.md b/.changes/validate-isolation-hook-set.md new file mode 100644 index 000000000..824783240 --- /dev/null +++ b/.changes/validate-isolation-hook-set.md @@ -0,0 +1,5 @@ +--- +"tauri-codegen": patch +--- + +Validate `__TAURI_ISOLATION_HOOK__` being set by a file in the isolation application. diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs index 202b19cca..75aa8926b 100644 --- a/core/tauri-codegen/src/context.rs +++ b/core/tauri-codegen/src/context.rs @@ -330,13 +330,28 @@ pub fn context_codegen(data: ContextData) -> Result, options: &AssetOptions, - map: impl Fn(&AssetKey, &Path, &mut Vec, &mut CspHashes) -> Result<(), EmbeddedAssetsError>, + mut map: impl FnMut( + &AssetKey, + &Path, + &mut Vec, + &mut CspHashes, + ) -> Result<(), EmbeddedAssetsError>, ) -> Result { // we need to pre-compute all files now, so that we can inject data from all files into a few let RawEmbeddedAssets { paths, csp_hashes } = RawEmbeddedAssets::new(input.into(), options)?; @@ -262,7 +267,8 @@ impl EmbeddedAssets { assets: HashMap::new(), }, move |mut state, (prefix, entry)| { - let (key, asset) = Self::compress_file(&prefix, entry.path(), &map, &mut state.csp_hashes)?; + let (key, asset) = + Self::compress_file(&prefix, entry.path(), &mut map, &mut state.csp_hashes)?; state.assets.insert(key, asset); Result::<_, EmbeddedAssetsError>::Ok(state) }, @@ -292,7 +298,12 @@ impl EmbeddedAssets { fn compress_file( prefix: &Path, path: &Path, - map: &impl Fn(&AssetKey, &Path, &mut Vec, &mut CspHashes) -> Result<(), EmbeddedAssetsError>, + map: &mut impl FnMut( + &AssetKey, + &Path, + &mut Vec, + &mut CspHashes, + ) -> Result<(), EmbeddedAssetsError>, csp_hashes: &mut CspHashes, ) -> Result { let mut input = std::fs::read(path).map_err(|error| EmbeddedAssetsError::AssetRead {