Skip to content

Add verified, privacy-safe local WebKit preview - #309

Merged
JJJ merged 1 commit into
mainfrom
eng/local-webkit-preview
Nov 10, 2026
Merged

JJJ merged 1 commit into
mainfrom
eng/local-webkit-preview

Conversation

@JJJ

@JJJ JJJ commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • add an opt-in macOS launcher for running Pasted against a caller-supplied local WebKit build
  • propagate framework selection to the app and its XPC services, then fail closed unless vmmap confirms the requested WebKit loaded
  • create a disposable, seeded demonstration database and start clipboard capture paused so recording cannot expose private history or the current clipboard
  • keep release builds, ordinary launches, and the real Pasted library untouched
  • document the development-only workflow and add a portable source-contract test

Validation

  • npm run test:frontend
  • npm run test:native
  • node scripts/test-local-webkit-preview.js
  • prior end-to-end launch against /private/tmp/WebKitBuild-live-resize/Release
  • prior vmmap confirmation of the requested local framework
  • prior lsof confirmation that the preview opened only the temporary demonstration database
  • prior interrupt cleanup confirmation for the preview database, Pasted, and Vite

The local WebKit build used for the earlier end-to-end validation is no longer present, so this reconciliation did not repeat that manual run.

Supersedes #306 after renaming the branch to use the repository-neutral eng/ prefix.

Copilot AI lite review requested due to automatic review settings September 1, 2026 23:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The debug-only preview database override is not validated/fail-closed, so a mis-set env var could still open/modify a real library, undermining the stated privacy-safety guarantees.

Pull request overview

Adds a development-only macOS launcher flow to run Pasted against a caller-supplied local WebKit build while isolating data and pausing capture for safer recordings, plus portable contract checks and documentation.

Changes:

  • Adds a debug-only database override via PASTED_PREVIEW_DATABASE_PATH and starts the clipboard monitor paused when that override is active.
  • Introduces a macOS-only launcher script that builds the debug app/CLI, seeds a temporary demo database, launches with local WebKit loader paths, and verifies the loaded WebKit via vmmap.
  • Wires the launcher into package.json, adds a portable source-contract test, and documents the workflow.
File summaries
File Description
src-tauri/src/clipboard_monitor.rs Adds an initially_paused parameter to start capture paused for preview runs.
src-tauri/src/app_runtime.rs Supports debug-only preview DB selection and passes “start paused” into the clipboard monitor.
scripts/run-with-local-webkit.sh New macOS launcher for local WebKit builds with vmmap verification and temp demo DB seeding/cleanup.
scripts/test-local-webkit-preview.js Adds a portable contract test ensuring the launcher’s key safety/verification steps remain present.
package.json Adds dev:local-webkit and includes the new contract test in test:platform.
docs/LOCAL_WEBKIT_PREVIEW.md Documents the local WebKit preview workflow and its safety properties.
Review details

Suppressed comments (1)

src-tauri/src/app_runtime.rs:12

  • PASTED_PREVIEW_DATABASE_PATH is treated as a trusted PathBuf in debug builds. If it is set incorrectly (relative path, or pointing at the user's real library), the app will silently open/modify that database, which undermines the PR's "privacy-safe" and "fail closed" goals. Consider validating the env var and failing closed unless it points at the script-managed pasted-local-webkit.* temp directory.
pub(crate) fn exit_requested() -> bool {
    EXIT_REQUESTED.load(Ordering::SeqCst)
}

  • Files reviewed: 8/8 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@JJJ
JJJ force-pushed the eng/local-webkit-preview branch from 549faf7 to 2c66382 Compare September 1, 2026 23:50
@JJJ

JJJ commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the preview-database safety concern in 6ae3f66.

The debug override now fails closed unless the supplied path:

  • is absolute and ends in pasted.db;
  • resolves directly beneath the canonical system temporary directory in a pasted-local-webkit.* directory;
  • already exists as a regular, non-symlink file; and
  • does not resolve outside that temporary directory.

An invalid override now aborts application setup instead of falling back to the ordinary Pasted library. I verified both paths locally: the script-managed preview still launches against the requested WebKit, while an unmanaged path exits before opening a database. npm run test:frontend, the GUI cargo check, formatting, and diff checks pass.

@JJJ
JJJ force-pushed the eng/local-webkit-preview branch from e5870cb to 4f9b6eb Compare November 10, 2026 06:52
@JJJ
JJJ merged commit 5dcaac8 into main Nov 10, 2026
19 checks passed
@JJJ
JJJ deleted the eng/local-webkit-preview branch November 10, 2026 07:01
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.

2 participants