Conversation
β¦ly ops Custom config paths (preview, add) and several desktop-side read/UX operations were rejecting valid paths in two scenarios: 1. Symlinked $HOME (e.g. Lumi's /users/<user> -> /pfs/lustrep*/users/<user>): is_path_allowed compared canonical file paths against the symlink-form home, never matching the prefix. 2. Work outside $HOME (HPC scratch dirs, external volumes, network shares): the home/project gate forced users to register a project just to track a single config file β unnecessary friction since the OS already gates reads via filesystem permissions. Changes: - is_path_allowed: canonicalize both sides before prefix comparison; reject non-existent paths (mirrors desktop semantics). Remains in use only as the deploy/write gate. - resolve_and_validate_config_path: extracted to hk_core::sanitize as the single authority for both web and desktop. Drops the home/project gate; keeps '..' rejection, exists() check, and home-itself rejection (now via canonicalize so trailing slashes / symlinks all reject correctly). - Desktop is_path_within_allowed_dirs: deleted entirely (was the equivalent gate for read-only ops; same trust-model justification). - Frontend: humanizeError accepts unknown (Tauri IPC rejects with reified HkError objects, not strings β String() wrapping produced "[object Object]"); preserve specific message for PathNotAllowed and PermissionDenied (previous git-flavored "repository may be private" wording was misleading for fs-perm errors); IME composition guard with e.keyCode !== 229 fallback (macOS WebKit isComposing is unreliable). Tested: 365 unit + integration tests, manual end-to-end on Lumi (web mode) and macOS desktop (cargo tauri dev). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Custom config paths (preview, add) and several desktop-side read/UX operations were rejecting valid paths in two scenarios:
$HOME(e.g. Lumi's/users/<user>β/pfs/lustrep*/users/<user>):is_path_allowedcompared canonical file paths against the symlink-form home, never matching the prefix.$HOME(HPC scratch dirs, external volumes, network shares): the home/project gate forced users to register a project just to track a single config file β unnecessary friction since the OS already gates reads via filesystem permissions.Backend
is_path_allowed: canonicalize both sides before prefix comparison; reject non-existent paths (mirrors desktop semantics). Remains in use only as the deploy/write gate.resolve_and_validate_config_path: extracted tohk_core::sanitizeas the single authority for both web and desktop. Drops the home/project gate; keeps..rejection,exists()check, and home-itself rejection (now viacanonicalizeso trailing slashes / symlinks all reject correctly).is_path_within_allowed_dirs: deleted entirely (was the equivalent gate for read-only ops; same trust-model justification).Frontend
humanizeErroracceptsunknown(Tauri IPC rejects with reifiedHkErrorobjects, not strings βString()wrapping produced"[object Object]").PathNotAllowed/PermissionDenied(previous git-flavored "repository may be private" wording was misleading for fs-perm errors).e.keyCode !== 229fallback (macOS WebKitisComposingis unreliable).Test plan
π€ Generated with Claude Code