Commit Graph
26 Commits
Author SHA1 Message Date
Ian Chua 113b42da33 Merge branch 'main' into fix/isolate-plugin-browser-session 2026-11-18 18:14:21 +08:00
Ian Chua 3838002bc8 feat: serialize permission grant for create and delete files (#17478)
* feat: serialize permission grant for create and delete files

* test: expect saved copytree permissions in hardlink audit test

* refactor: simplify plugin filesystem and permission handling

* fix: show triggering paths in plugin permission prompts

* fix: require subtree consent for recursive plugin deletes

* fix: tests

* fix: Windows short-path aliases in plugin audit checks

* fix: correct plugin folder permission display and consent text
2026-11-18 17:50:29 +08:00
Ian Chua 0aa479f27c fix: overlapping permission dialogs (#17318)
* fix: queue permissions dialogs

* fix: serialize plugin permission dialogs across prompt types

* fix: unit tests

* fix: move audit prompt stuff to PluginAuditManager

* fix: discard pending permission requests when plugin load is cancelled

* fix: simplify audit prompt cancellation and align denial tests with prod

* fix: queued permission prompts lost after plugin load failure
2026-11-17 14:33:17 +08:00
932b492252 feat: Add plugin permission management to the Plugins dialog (#17285)
* feat: permissions tab in plugin dialog ui draft

* feat: allow full access, make threading a boolean

* fix: clang-tidy

* feat: save changes button

* fix: clang-tidy

* fix: only allow permission editing when plugin not loaded

* fix: plugin permission drafts, target validation, and sidecar synchronization

* fix: minor html/css changes

* fix: Make plugin permission edits immediate and thread-safe

* refactor: rehaul UI

* fix: add don't show again to request permission dialog

* fix: permission request dialog ui

* fix: clean up plugin permission dialog and mutation APIs

* fix: retry Windows plugin permission file replacement

* test: extract and cover plugin permission validators

* fix: show clear denial for worker plugin file operations

* fix: clang-tidy

* docs: clarify plugin filesystem permissions and clean up declaration

* fix: handle the 3 states of install state read

* fix: match equivalent paths for exact filesystem grants

* fix: preserve unreadable plugin state and allow socket grant editing

* Recover plugins whose install-state file cannot be parsed

---------

Co-authored-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
2026-11-07 00:00:18 +08:00
2ec1a0732f Plugin audit: keep non-Latin path names intact in the keyword check (#16925)
* Keep non-Latin path names intact in the plugin audit keyword check

is_denied_path_keyword() lowercased every path component with
std::tolower(), which follows the C locale. With a single-byte locale,
which the UI language sets on Windows (Russian_Russia.1251), that
rewrites bytes of UTF-8 sequences: "Новая папка" is no longer valid
UTF-8, and has_denied_config_extension() then throws "boost::filesystem
::path codecvt to wstring: partial" while turning it back into a path.
The exception left the CPython audit hook, so the plugin call never
returned, and the app crashed later in PyFrame_GetCode.

The keyword check now uses the file's ascii_lower(), which lowercases
A-Z only; the keywords are ASCII, so matching stays case-insensitive.
ascii_lower() itself no longer goes through a locale-aware
boost::algorithm::to_lower(), so the network permission keys get the
same guarantee. The audit hook also no longer lets any C++ exception
reach the interpreter: a check that fails denies the event, like an
unanswered prompt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Address review: narrower try in audit_hook, shorter comments, a test for the catch

- Wrap only audit_plugin_event() in the try, so release_frames() is called
  once after the event is decided.
- Shorten the ascii_lower() comment and drop the one that repeated it.
- Use only the .1251 locale in the non-Latin path test.
- Test that a permission prompt that throws denies the event, which
  reaches the new catch on every platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: GNUGiminot <215263196+GNUGiminot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
2026-11-06 20:35:44 +08:00
Ian Chua e740246f7e Merge branch 'main' into fix/isolate-plugin-browser-session 2026-11-04 14:42:59 +08:00
SoftFever 54afdaf887 Merge branch 'main' into fix/plugin-network-permissions 2026-10-24 23:58:51 +08:00
peachismomo de6861bb38 fix: tests 2026-10-24 01:40:28 +08:00
Ian Chua 9739d3a9c4 fix: reject symlink and resolve relative paths to absolute 2026-10-23 16:48:34 +08:00
Ian Chua 3ba5ddfe19 fix: Share isolated WebView sessions per plugin profile 2026-10-23 16:34:44 +08:00
Ian Chua 6a0223f055 fix: Tighten plugin network grants and clarify consent scope 2026-10-23 16:12:57 +08:00
Ian Chua 2410112046 feat: add wildcard permissions for fs 2026-10-22 20:49:57 +08:00
Ian Chua 0ae2b4840b Merge branch 'main' into fix/plugin-network-permissions 2026-10-22 13:55:07 +08:00
Ian Chua 4441bcc065 fix(test): keep embedded Python alive across slic3rutils cases (#16732)
* fix(test): keep embedded Python alive across slic3rutils cases

* fix: clang-tidy
2026-10-22 13:40:14 +08:00
Ian Chua 1abb2a0fd9 fix: flatpak audit denial because of config in path (#16685) 2026-10-21 17:48:19 +08:00
Ian Chua 9f030a9559 Merge branch 'main' into fix/plugin-network-permissions 2026-10-21 15:46:07 +08:00
Ian ChuaandSoftFever 37dcc65752 fix: Allow plugins to read the embedded Python stdlib (#16669)
* Stop re-asking for plugin permissions granted in an earlier session

* fix: Allow plugins to read the embedded Python stdlib

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
2026-10-20 21:31:25 +08:00
Ian Chua 4a0d5e5edd Merge branch 'main' into fix/plugin-network-permissions 2026-10-20 18:23:02 +08:00
Ian Chua e7d6cc32a7 fix: deny plugin from modifying plugin sidecar (#16634) 2026-10-20 18:04:42 +08:00
SoftFever 6626377abc Stop re-asking for plugin permissions granted in an earlier session (#16658) 2026-10-20 13:38:44 +08:00
Ian Chua 6c791532c6 fix: update api to allow requesting network permissions 2026-10-20 01:15:14 +08:00
Ian Chua 86ff2a9de7 fix: avoid substring denies in audit path keywords (#16243)
## Summary

   Fixes #15944.

   The plugin audit deny-list matched `secret`, `cert`, and
 `conf` as substrings of every path component. This blocked
 valid imports during plugin capability execution, for example
 `numpy/__config__.py`, because `conf` appeared inside the
 module filename.

   This PR changes deny keyword matching to use whole path
 components instead of substring matches. It keeps the
 intended protections for sensitive locations and config
 files, while allowing dependency and stdlib modules whose
 names merely contain those strings.

   ## Changes

   - Match denied path keywords as whole components instead of
 substrings.
   - Keep denying sensitive directory names such as:
     - `secret`
     - `secrets`
     - `cert`
     - `certs`
     - `certificate`
     - `certificates`
     - `conf`
     - `config`
   - Keep denying config files by extension:
     - `.conf`
     - `.ini`
   - Allow legitimate Python module/package paths such as:
     - `numpy/__config__.py`
     - `numpy/_core/_ufunc_config.py`
     - `configparser.py`
     - `sysconfig.py`
     - `logging/config.py`
     - `certifi/cacert.pem`
   - Include the denied target and reason in `PermissionError`
 messages when the audit hook blocks an operation.
   - Remove an unused `<memory>` include from
 `PluginAuditManager.hpp`.

   ## Why

   The previous substring matching caused false positives for
 common dependency and standard-library paths. It also made
 failures hard to diagnose because the Python exception did
 not include the refused path.

   The new behavior is narrower: it blocks sensitive path
 components and config file extensions without treating
 unrelated names like `__config__.py`, `configparser.py`,
 `Conference`, or `Concert` as secrets.

   ## Testing

   - Added/updated unit coverage in
 `tests/slic3rutils/test_plugin_audit.cpp` for:
     - whole-component keyword matches
     - `.conf` / `.ini` blocking
     - case-insensitive matching
     - false-positive paths from #15944

Plugin used for testing:

[orca_audit_numpy_config_repro.py](https://github.com/user-attachments/files/33143848/orca_audit_numpy_config_repro.py)
2026-10-09 15:20:38 +08:00
HanifKoh 84657ff11e Add Missing Includes Across the Remaining Sources and Tests (#16071)
* Ignore Clipper, libpng, mcut and Boost.Polygon Internals in clang-tidy

Each only works through a wrapper or umbrella header: libslic3r/clipper.hpp or clipper_z.hpp configure Clipper before including it, png.h pulls in libpng's config headers, and Boost.Polygon's headers only compile through polygon.hpp or voronoi.hpp.

* Ignore minilzo's Config Headers in clang-tidy

lzoconf.h and lzodefs.h are internal to minilzo.h, which is what the code includes.

* Add Missing Includes Across the Remaining Sources and Tests

Covers src/slic3r/Utils, src/slic3r/plugin, src/slic3r/Config, src/libvgcode, src/dev-utils, src/OrcaSlicer.cpp and tests/, the directories left after src/slic3r/GUI and src/libslic3r. Generated with clang-tidy misc-include-cleaner. libvgcode's own headers are included by relative path as in the rest of that library, and Catch2 and pybind11 with angle brackets as elsewhere in the repo.

* Make the GUI and Test Headers Compile on Their Own

Each now includes, or forward-declares, what it uses instead of relying on what its includers happened to include first. Headers that only compile on one platform, or that nothing built includes, are left alone.

* Keep Windows and nanosvg Setup Ahead of the Added Includes

OrcaSlicer.cpp and several tests set _WIN32_WINNT, WIN32_LEAN_AND_MEAN or NOMINMAX before including Windows.h, and the profile validator defines NANOSVG_IMPLEMENTATION before any libslic3r header. The added includes had landed above those blocks, which broke the Windows build.

* Add the GUI Includes the First Pass Missed

Covers headers that only became editable once they compiled on their own, and wx symbols whose suggested header changed as the clang-tidy ignore list grew after the src/slic3r/GUI pass.

* Keep the Added Test Includes Below the NOMINMAX Guard

test_marchingsquares.cpp and test_texture_displacement.cpp had includes inside #ifndef NOMINMAX, which the tests inherit as defined on Windows from libslic3r, so those were skipped there. .clang-tidy also ignores the MSVC STL and UCRT internals, Boost.Multiprecision's fwd.hpp and CPython's Windows include directory, as in #16068.
2026-10-03 13:45:21 +08:00
Ian Chua f6f68573b6 fix: add resources folder to the allowed roots as readonly 2026-08-14 14:48:57 +08:00
Ian Chua 2169b72c94 fix: update tests 2026-07-28 19:28:58 +08:00
SoftFever 88fb89b5eb 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.
2026-07-18 01:24:44 +08:00