mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-04 08:42:10 +00:00
Plugin audit (#14821)
* Block plugins from reading or writing app config and cloud credentials Add a denied-filename registry to the plugin audit sandbox, seeded with OrcaSlicer's config (.conf/.ini) and the cloud refresh-token file. The deny is checked above the loading-mode read exemption and the allowed roots, so a plugin cannot reach these files even though they sit inside data_dir(), which is itself an allowed root. Case-insensitive prefix matching also covers the .bak/.tmp companions that hold the same data, and os.rename/os.remove are hooked alongside open so the files cannot be deleted or clobbered either.
This commit is contained in:
@@ -571,7 +571,7 @@ int OrcaCloudServiceAgent::init_log() { return BAMBU_NETWORK_SUCCESS; }
|
||||
int OrcaCloudServiceAgent::set_config_dir(std::string cfg_dir)
|
||||
{
|
||||
config_dir = cfg_dir;
|
||||
wxFileName fallback(wxString::FromUTF8(cfg_dir.c_str()), "orca_refresh_token.sec");
|
||||
wxFileName fallback(wxString::FromUTF8(cfg_dir.c_str()), secret_constants::USER_SECRET_FILENAME);
|
||||
fallback.Normalize();
|
||||
secret_fallback_path = fallback.GetFullPath().ToStdString();
|
||||
return BAMBU_NETWORK_SUCCESS;
|
||||
|
||||
@@ -55,6 +55,15 @@ namespace auth_constants {
|
||||
constexpr const char* LOGOUT_PATH = "/auth/v1/logout";
|
||||
} // namespace auth_constants
|
||||
|
||||
// Names of the on-disk credential files inside the config dir.
|
||||
namespace secret_constants {
|
||||
// Encrypted refresh-token fallback file, written when wxSecretStore is unavailable.
|
||||
// Also seeded into PluginAuditManager's denied-filename registry (install_hook), which
|
||||
// additionally covers the ".tmp" staging file the token is written to before its atomic
|
||||
// rename, so plugins can read neither.
|
||||
constexpr const char* USER_SECRET_FILENAME = "orca_refresh_token.sec";
|
||||
} // namespace secret_constants
|
||||
|
||||
// ============================================================================
|
||||
// Sync Protocol Data Structures (per Orca Cloud Sync Protocol Specification)
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user