fix(core): capability filtering crashing allowed command generation - #13476
Conversation
tauri-plugin and tauri build scripts cannot have access to the capabilities file (generated by tauri-build) and can only infer capabilities from the config path
Package Changes Through 39938efThere are 8 changes which include tauri-bundler with patch, tauri with minor, tauri-cli with patch, tauri-codegen with minor, tauri-utils with minor, @tauri-apps/api with minor, @tauri-apps/cli with patch, tauri-runtime-wry with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
| capabilities.extend(crate::acl::get_capabilities(&config, None, None)?); | ||
| let capabilities_file_path = out_dir.join(CAPABILITIES_FILE_NAME); | ||
| // the capabilities file only exist in the tauri-build context | ||
| if !capabilities_file_path.exists() { |
There was a problem hiding this comment.
Would this call be a problem when the build script re-runs? I think maybe we could move back the
if let Some(capabilities_file_path) = pre_built_capabilities_file_path {
if capabilities_file_path.exists() {
let capabilities_file =
std::fs::read_to_string(capabilities_file_path).context("failed to read capabilities")?;
capabilities_from_files =
serde_json::from_str(&capabilities_file).context("failed to parse capabilities")?;
}
}part to tauri-codegen, and replace pre_built_capabilities_file_path param with capabilities_from_files: BTreeMap<String, Capability>, and we don't have to save the files here (this file should only be used for passing the data from tauri-build to tauri-codegen right? (maybe we should document this, I'm having a hard time revisiting this code 😂))
There was a problem hiding this comment.
same, it was a nightmare 🤣
Co-authored-by: Tony <68118705+Legend-Master@users.noreply.github.com>
tauri-plugin and tauri build scripts cannot have access to the capabilities file (generated by tauri-build) and can only infer capabilities from the config path (from the env var)