This commit enhances application security against potential attacks by isolating dependencies that access the host system (like file operations) from the renderer process. It narrows the exposed functionality to script execution only, adding an extra security layer. The changes allow secure and scalable API exposure, preparing for future functionalities such as desktop notifications for script errors (#264), improved script execution handling (#296), and creating restore points (#50) in a secure and repeatable way. Changes include: - Inject `CodeRunner` into Vue components via dependency injection. - Move `CodeRunner` to the application layer as an abstraction for better domain-driven design alignment. - Refactor `SystemOperations` and related interfaces, removing the `I` prefix. - Update architecture documentation for clarity. - Update return types in `NodeSystemOperations` to match the Node APIs. - Improve `WindowVariablesProvider` integration tests for better error context. - Centralize type checks with common functions like `isArray` and `isNumber`. - Change `CodeRunner` to use `os` parameter, ensuring correct window variable injection. - Streamline API exposure to the renderer process: - Automatically bind function contexts to prevent loss of original context. - Implement a way to create facades (wrapper/proxy objects) for increased security.
check-desktop-runtime-errors
This script automates the processes of:
- Building
- Packaging
- Installing
- Executing
- Verifying Electron distributions
It runs the application for a duration and detects runtime errors in the packaged application via:
- Log verification: Checking application logs for errors and validating successful application initialization.
stderrmonitoring: Continuous listening to thestderrstream for unexpected errors.- Window title inspection: Checking for window titles that indicate crashes before logging becomes possible.
Upon error, the script captures a screenshot (if --screenshot is provided) and terminates.
Options
--build: Clears the electron distribution directory and forces a rebuild of the Electron app.--screenshot: Takes a screenshot of the desktop environment after running the application.
This module provides utilities for building, executing, and validating Electron desktop apps. It can be used to automate checking for runtime errors during development.
Configs
Configurations are defined in config.ts.