mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-23 10:52:15 +00:00
* 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.
56 lines
2.1 KiB
CMake
56 lines
2.1 KiB
CMake
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
|
|
add_executable(${_TEST_NAME}_tests
|
|
${_TEST_NAME}_tests_main.cpp
|
|
test_action_source.cpp
|
|
test_plugin_host_api.cpp
|
|
test_plugin_capability_config.cpp
|
|
test_plugin_config.cpp
|
|
test_plugin_capabilities_in_use.cpp
|
|
test_plugin_install.cpp
|
|
test_plugin_lifecycle.cpp
|
|
test_slicing_pipeline_bindings.cpp
|
|
test_slicing_pipeline_config.cpp
|
|
test_plugin_sort.cpp
|
|
test_plugin_cloud_metadata.cpp
|
|
test_plugin_audit.cpp
|
|
../fff_print/test_helpers.cpp
|
|
)
|
|
|
|
if (MSVC)
|
|
target_link_libraries(${_TEST_NAME}_tests Setupapi.lib)
|
|
endif ()
|
|
|
|
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r_gui libslic3r pybind11::embed Catch2::Catch2WithMain)
|
|
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
|
|
|
orcaslicer_copy_test_dlls()
|
|
|
|
if (WIN32)
|
|
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_PREFIX_PATH}/libpython" "$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
"${CMAKE_PREFIX_PATH}/libpython/python${_bundled_python_abi}.dll"
|
|
"${CMAKE_PREFIX_PATH}/libpython/vcruntime140.dll"
|
|
"${CMAKE_PREFIX_PATH}/libpython/vcruntime140_1.dll"
|
|
"$<TARGET_FILE_DIR:${_TEST_NAME}_tests>"
|
|
COMMENT "Copying Python runtime for slic3rutils plugin host API tests"
|
|
VERBATIM
|
|
)
|
|
elseif (APPLE)
|
|
target_link_options(${_TEST_NAME}_tests PRIVATE
|
|
"LINKER:-rpath,@executable_path/python/lib")
|
|
|
|
add_custom_command(TARGET ${_TEST_NAME}_tests POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E rm -rf
|
|
"$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
"${CMAKE_PREFIX_PATH}/libpython"
|
|
"$<TARGET_FILE_DIR:${_TEST_NAME}_tests>/python"
|
|
COMMENT "Copying Python runtime for macOS plugin host API tests"
|
|
VERBATIM
|
|
)
|
|
endif()
|
|
|
|
orcaslicer_discover_tests(${_TEST_NAME}_tests)
|