Apps - #785
Open
Hadamcik wants to merge 475 commits into
Open
Conversation
…tion - Replaced `normalize_and_validate_granted_capabilities` with `normalize_and_validate_user_granted_capabilities` for naming clarity. - Updated `resolve_effective_granted_capabilities` to `resolve_and_validate_effective_granted_capabilities` for improved modularity and consistency. - Consolidated `capabilities` logic by integrating validation within normalization workflows. - Added comprehensive test coverage in `validation.rs` and `tests.rs` for updated capability workflows. - Simplified imports and visibility settings across modules to improve code organization.
- Eliminated `clear_storage_taint` parameter from permission handling functions. - Removed associated logic from `update_app_permissions` and internal workflows. - Deleted obsolete unit test `update_app_permissions_internal_can_clear_storage_taint_without_capabilities`. - Simplified imports by removing `clear_storage_may_contain_secrets` usage.
…normalization - Merged required and optional whitelist logic into a single `allowed` set in `validation.rs` for cleaner validation. - Simplified `normalize_network_entries` by using functional constructs and removing manual sorting in `normalization.rs`.
- Deleted tests and helper functions that have overlapping coverage or were no longer relevant to streamlined validation workflows (`bridge`, `capabilities`, and `lifecycle` modules). - Consolidated core testing logic into related modules for better organization and clarity. - Updated imports and visibility settings across affected files.
- Deleted multiple normalization and validation functions in `capabilities` and `network` modules. - Refactored to rely on simplified permission handling workflows. - Updated associated imports, tests, and permissions logic for streamlined workflow integration.
- Added detailed structs for Sage App representation (`SageApp`, `UserSageApp`, `SystemSageApp`, etc.) to enhance capability and permission management. - Included manifest parsers and validators (`SageAppPackageManifest`, `SageRequestedPermissions`, etc.) for strict compliance with app specifications. - Modularized app-related types (`app.rs`, `permissions.rs`, `manifest.rs`, `network.rs`, `storage.rs`) for improved maintainability. - Enhanced validation workflows for network and capabilities permissions. - Defined reusable logic for app lifecycle management and manifest integrity checks.
- Implemented custom deserialization logic for `SageNetworkWhitelistEntry` to support both string and object formats. - Replaced basic manifest deserialization with `serde_path_to_error` for detailed error reporting. - Updated `Cargo.toml` to include `serde_path_to_error` dependency. - Adjusted related structs and logic across `permissions.rs` and `network.rs` for improved consistency and flexibility.
- Deleted deprecated `types_legacy.rs` file and its content. - Removed obsolete unit tests that referenced legacy type definitions or workflows.
… handling - Moved `builtin_apps_root` into the `utils` module for consistency and reusability. - Updated references across `system_apps`, `sandbox`, and `build` modules. - Simplified file path resolution and validation for system apps manifest and directories. - Improved error messages related to builtin system app handling. - Adjusted `sage-manifest.json` to correctly reference the public icon path.
- Extracted common app update retrieval logic into `fetch_pending_update`. - Simplified `check_app_update`, `update_app_pending_state`, and `apply_app_update` for better maintainability. - Added `from_pending_update` constructor to `SageAppUrlPreview` for consistency.
…n` components - Extracted icon rendering logic into reusable `AppIconContent` and `AppIcon` components. - Replaced inline logic for app icons across multiple files (`AppTaskBar`, `InstallDialog`, `AppTile`, etc.) to improve consistency. - Adjusted `InstallSource` type export for shared use. - Simplified icon URL resolution and fallback logic for better maintainability.
…ogic - Moved capability-related validation and construction logic from `permissions.rs` to `invariants.rs`. - Introduced reusable functions: `validate_permissions_policy`, `validate_requested_capabilities_are_requestable`, and `build_user_grantable_capability_set`. - Simplified `SageRequestedPermissions` and related methods for better reusability and maintainability. - Removed redundant `build_capabilities` and inlined checks into reusable helpers.
…st and capability construction - Introduced `split_required_optional_set` in `invariants.rs` to centralize logic for handling `required` and `optional` sets. - Updated `SageNetworkWhitelist` and `SageRequestedPermissions` constructors to use the new helper function. - Simplified filtering logic for consistency and maintainability.
- Split `invariants.rs` into `app.rs`, `manifest.rs`, and `permission.rs` for better modularity. - Moved app-related, manifest-related, and permission-related logic into respective modules. - Updated imports across the project to reflect the new structure. - Introduced `resolve_app_capability_flags` to simplify and reuse capability flag resolution logic.
- Replaced `capabilities_vec` with `has_capability` for direct capability checks. - Removed redundant methods across `user.rs`, `permissions.rs`, and related files. - Streamlined permission and capability handling for improved clarity and maintainability.
- Removed `into_sage_app` and `new_builtin` methods as they were unused. - Streamlined `PersistentStorage` capability check by introducing `has_persistent_storage` intermediate variable. - Cleaned up unused imports and reduced redundant code to improve clarity.
- Introduced `app_path` method in `SageAppCommon` and exposed it in related structs. - Replaced redundant `app_dir` conversions with `app_path` across multiple files (`commands.rs`, `permissions.rs`, etc.). - Cleaned up imports and removed unused `PathBuf` declarations.
…try`/`icon` retrieval - Removed `manifest_entry_file` and `manifest_icon_file` in favor of using `manifest.entry()` and `manifest.icon()` directly. - Updated `entry()` to provide a default value of `"index.html"` for consistency. - Cleaned up related tests and updated assertions accordingly.
… manifest validation logic - Added `SageAppUrl` and `SageAppManifestUrl` types for improved URL handling and validation. - Consolidated manifest-related validation into `invariants::manifest.rs` to centralize logic. - Removed redundant functions and tests, migrating necessary logic to updated modules. - Simplified the `fetch_url_manifest` and manifest derivation process using new URL types.
…ation - Moved limit constants (`MAX_APP_FILE_COUNT`, `MAX_APP_TOTAL_SIZE_BYTES`, `MAX_APP_PATH_LENGTH`) into `manifest.rs` for centralization. - Replaced `validate_package_structure` with `SageAppPackageManifest::validate_package_files`. - Cleaned up imports, removing unused dependencies and redundant function logic. - Updated all package validation calls to use the refactored `validate_package_files` method for consistency.
…rganization - Moved all manifest-related tests from `lifecycle/manifest.rs` to `types/manifest.rs` to centralize test logic. - Cleaned up redundant code and ensured test consistency during relocation.
…lize URL validation logic - Introduced `SageAppUrl` and `SageAppManifestUrl` types for robust app and manifest URL management. - Consolidated URL validation and normalization logic into `invariants/url.rs`. - Replaced string-based `app_url` and `manifest_url` with `SageAppUrl` across the codebase. - Updated related methods, tests, and imports for consistency and maintainability.
Import changes
- Introduced `set_builtin_apps_root` to allow dynamic configuration of the `builtin-apps` root directory. - Updated Tauri app initialization to set `builtin-apps` root from bundled resources directory if available. - Modified `tauri.conf.json` to include `builtin-apps` in bundled resources.
… locales - Synced translation changes in `en-US`, `es-MX`, `zh-CN`, and `de-DE` locales. - Added new entries for "Apps" and adjusted context references for updated components. - Addressed line number updates and structural changes in `src/components/Nav.tsx` and other related components.
…ross-platform compatibility
…ld process - Introduced a new `generate_docs` binary in `sage-apps` for generating Sage app documentation. - Updated `build.rs` to remove in-process docs generation in favor of the new binary. - Modified `package.json` to include `generate:app-docs` script and integrate docs generation into the `build:builtin-apps` process. - Added Tauri Android and iOS configuration files with a `beforeBuildCommand` to build the frontend.
… function signatures
This was referenced Jul 3, 2026
Bridge responses and per-app runtime events were delivered with `Emitter::emit`, which in Tauri broadcasts to every webview that has a JS listener for the event name rather than only the intended one. Since `wallet.getSecretKey` (and other approval-gated) results are delivered over the `sage-bridge:response` rail, a second user app running concurrently could subscribe to that event and capture another app's secret key material and bridge results. Deliver `sage-bridge:response` and the user/system runtime event rails with `emit_to(<app webview label>, ...)` so each payload reaches only the originating app's webview. The broadcast to the trusted main Sage webview (`apps:runtime-event`) is unchanged and documented.
…ndexedDB seeding, and validate storage probe data. Integrate host isolation seeding into tests.
…d methods documentation.
…prove error handling, and optimize staging process.
…before applying updates; add tests and update related function signatures.
… state rechecks, and reload mechanisms; standardize table formatting in generated documentation.
…dering logic, add tests, and improve markdown formatting.
…tain operation locks until initialization completes; include tests for guard behavior.
…L resolution logic; include loopback and private network restrictions with tests.
…restrictions; add corresponding tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reviewer map
sage-appscrateSage Apps is built around one core rule: backend owns state and authority. The frontend is only a presentation layer and is not trusted to decide permissions, app identity, runtime state, wallet scope, approval results, install/update validity, or storage/origin ownership.
Most sensitive behavior is intentionally funneled through a small exported surface from
crates/sage-apps/src/lib.rs, solib.rsis the best first review file.crates/sage-apps/src/lib.rsThe crate exports the following authority entry points:
Where to go from
lib.rslib.rsis the map of the crate boundary. From each export group, follow these review paths.1. Bridge protocol: how apps interact with Sage
From:
Review:
crates/sage-apps/src/bridge/commands.rscrates/sage-apps/src/bridge/registry.rscrates/sage-apps/src/bridge/methods/shared.rscrates/sage-apps/src/bridge/methods/user/**crates/sage-apps/src/bridge/methods/system/**crates/sage-apps/src/security/**Important things to verify:
requestable_by_app2. App isolation model: what apps are allowed to be
Review:
crates/sage-apps/src/types/app/common.rscrates/sage-apps/src/types/app/wallet_scope.rscrates/sage-apps/src/types/invariants/permission.rscrates/sage-apps/src/types/permissions/**crates/sage-apps/src/capabilities/definitions.rscrates/sage-apps/src/capabilities/types.rscrates/sage-apps/src/db/**Important things to verify:
user_grantablerequestable_by_appshared_with_app3. Install/update/permission mutation: what changes app authority
Review:
crates/sage-apps/src/lifecycle/package.rscrates/sage-apps/src/lifecycle/install/**crates/sage-apps/src/lifecycle/update/**crates/sage-apps/src/lifecycle/mutation/**crates/sage-apps/src/bridge/methods/system/app_install/**crates/sage-apps/src/bridge/methods/system/app_update/**crates/sage-apps/src/bridge/methods/system/app_permissions/**Important things to verify:
4. Runtime lifecycle: how durable app state becomes webviews
From:
Review:
crates/sage-apps/src/runtime/state/**crates/sage-apps/src/runtime/start.rscrates/sage-apps/src/runtime/stop.rscrates/sage-apps/src/runtime/resolve.rscrates/sage-apps/src/runtime/webview.rscrates/sage-apps/src/runtime/commands.rsImportant things to verify:
5. Storage/origin rotation and cleanup
From:
Review:
crates/sage-apps/src/types/storage/**crates/sage-apps/src/db/storage.rscrates/sage-apps/src/lifecycle/clear_data/**crates/sage-apps/src/lifecycle/storage_cleanup/**crates/sage-apps/src/lifecycle/update/permissions.rsImportant things to verify:
6. Sandbox validation
From:
Review:
crates/sage-apps/src/sandbox/**builtin-apps/src/sandbox-test/**Important things to verify:
7. Secondary/supporting exports
From:
Review later:
crates/sage-apps/src/settings.rscrates/sage-apps/src/bridge/ts_exports.rscrates/sage-apps/src/build/docs.rs