fix(files): block privilege escalation via set_permissions on sync folders#98
fix(files): block privilege escalation via set_permissions on sync folders#98martinmarsian wants to merge 3 commits into
Conversation
…lders A user with wired.account.file.set_permissions could assign themselves as owner of a sync folder they do not own, which would grant new read access. Read the existing owner from .wired/permissions directly and deny the request when a non-owner tries to claim ownership. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @nark's task in 1m 57s —— View job Code Review — PR #98: block privilege escalation via
|
…rship check Two review-identified gaps in the privilege escalation guard: 1. Nil bypass: when no .wired/permissions file existed, FilePrivilege(path:) returned nil and the ownership check was silently skipped, letting the first caller with set_permissions claim ownership on any unowned folder. The else branch now blocks that claim for non-admins (wired.account.settings.edit required for initial ownership). 2. Path mismatch: the check previously read from realPath while the write used finalPath (alias/symlink resolved). Hoisting finalPath above the check ensures both operations target the same canonical location. 3. Compound if condition (idiomatic Swift, no nested ifs). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
wired.account.settings.edit does not exist in the protocol spec — hasPrivilege() always returned false, blocking every caller (including admins) from setting initial ownership on new folders. Replaced with the correct wired.account.account.edit_users which correctly identifies admin-level accounts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Follow-up on the Claude review findings — both flagged items have been addressed in commits pushed after the review ran.
The automated re-review can't fire (no |
Summary
wired.account.file.set_permissionscould assign themselves as owner of a sync folder they do not own, granting new read access to that folder..wired/permissionsviaFilePrivilege(path:)and rejects the request withwired.error.permission_deniedwhen a non-owner attempts to claim ownership..wired/typeis present.Test plan
🤖 Generated with Claude Code