Skip to content

fix(desktop): Phase 2c step 1, stop data loss and make the webview trust boundary real - #452

Merged
siracusa5 merged 12 commits into
mainfrom
ux/p2c-safe-truthful
Nov 6, 2026
Merged

siracusa5 merged 12 commits into
mainfrom
ux/p2c-safe-truthful

Conversation

@siracusa5

Copy link
Copy Markdown
Collaborator

Phase 2c step 1 (spec specs/ux-consolidation/spec.md AC-48..AC-54, cards 2c.1–2c.7). This is the safety work to land before v0.13.0, the first stable release with the Machine view.

What changes

  • Uninstall (AC-48): requires name@marketplace, deletes only cache/<marketplace>/<name>, and rewrites installed_plugins.json before deleting anything.
  • Presets (AC-49): merge into existing rules and keep key order. Before dropping a deny rule they show the exact list, and the user must confirm that same list.
  • User config writes (AC-50): atomic, digest-checked (a changed-on-disk refusal offers a reload) and backed up to ~/.harness/backups/user/<stamp>/. Covers CLAUDE.md, harness.yaml, plugin files, settings.json, env config, installed_plugins.json and custom profiles. A symlinked dotfile is followed to its target; the backup never lands in the dotfiles repo.
  • Onboarding (AC-51): an existing harness.yaml is kept unless you choose Replace after seeing the diff.
  • Capabilities (AC-52):
    • Removes shell execute/spawn/stdin/kill, fs:allow-write-text-file, and the unused worktree commands.
    • lstat and mkdir are granted at the existing scope. These calls were made but not granted, so Drift Fix failed in the real app.
    • Rename, remove and temp writes go through guarded_* Rust commands. In home they act only on a declared store's own temp file. In a project they act only on declared project stores, and never in .git. "Remove" of a store moves it to ~/.harness/backups/quarantine/.
    • Project scope, plugin import and export destinations come from native dialogs or OS drops, never webview paths.
  • Compile (AC-53): refuses symlinked path components, dangling or not, and writes atomically.
  • Secrets (AC-54): stored through Security.framework in-process, never on argv.
  • Zip import: capped per entry.

Needs your eye

  • packages/core gains projectWriteScope(), which is additive and generated into write-scope.json. The spec lists core as ask-first. It sits inside the approved Step 1 work, but it's flagged here.
  • Project folders saved by older builds must be re-picked once (picks are now Rust-side).
  • Presets merge, so they can't narrow existing allows. The UI now says "merged into your existing rules".

Verification

  • Desktop: vitest 773/773 (--maxWorkers=2; the default parallel run is timing-flaky on this machine, including a MachinePage test this branch doesn't touch). tsc clean.
  • Rust: cargo test --lib 239 passed, clippy -D warnings clean, check:capabilities OK.
  • Core: 864 passed.
  • Every fix was mutation-checked: removing it made a test fail.
  • Reviews:
    • Spec compliance (sonnet).
    • Adversarial security review (opus): 10 findings, then a re-review of the fix commit found 3 more. All are fixed.
  • The app builds and launches with tauri dev with no capability errors. Native dialogs and drag-drop were not clicked through.
  • lefthook isn't installed in this environment, so commit hooks didn't run locally.

🤖 Generated with Claude Code

siracusa5 and others added 11 commits November 6, 2026 00:12
…ed with a backup (AC-51)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th, by full key (AC-48)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omically (AC-53)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eychain secrets never on argv (AC-49, AC-54)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rename/remove; dialog-bound project scope (AC-52)

Removes shell execute/spawn/stdin/kill and the unused worktree commands. lstat and mkdir are granted at the existing scope; rename and remove go through Rust commands that keep paths inside declared roots. Project dirs saved by older builds must be re-picked once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d up; zip entries capped (AC-50)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a native dialog, clean refused temp files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- guarded rename only moves a temp file onto its own store, or within one
  granted root; remove deletes only temp files and backups, and moves a
  store to ~/.harness/backups/quarantine instead of deleting it
- drop fs:allow-write-text-file; the engine's temp writes go through
  guarded_write_file
- plugin import takes a native-dialog pick or an OS drop, not a webview path
- uninstall requires name@marketplace, deletes only cache/<mkt>/<name>, and
  rewrites the record before deleting anything
- presets confirm the exact deny list shown; permissions, env config and
  installed_plugins.json writes are digest-checked, atomic and backed up
- user-scope writes follow a symlinked dotfile to its target
- claude_md refuses . and .. before creating directories

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ups out of dotfiles

- inside a granted project root, guarded write/rename/remove act only on the
  temp file of a declared project store (new projectWriteScope in core,
  generated into write-scope.json); any .git component is refused
- quarantined files can't be overwritten by write or rename
- write_user_file backups go to ~/.harness/backups/user/<stamp>/, never
  beside a symlink target in a dotfiles repo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d_permissions shapes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@siracusa5
siracusa5 merged commit 7006afa into main Nov 6, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant