Skip to content

Add secure, reopenable HTML artifact previews - #94

Open
zenacquire wants to merge 2 commits into
milind-soni:mainfrom
zenacquire:codex/html-artifacts
Open

Add secure, reopenable HTML artifact previews#94
zenacquire wants to merge 2 commits into
milind-soni:mainfrom
zenacquire:codex/html-artifacts

Conversation

@zenacquire

Copy link
Copy Markdown

What changed

  • Added compact HTML creation cards that can expand while code is still streaming.
  • Added persistent chat controls to open, close, and reopen the artifact that belongs to that message.
  • Added a side-by-side, keyboard- and pointer-resizable artifact panel with cleanup on close.
  • Isolated model-authored HTML with an opaque iframe sandbox and a restrictive srcdoc CSP that blocks outbound network access.
  • Added Electron subframe navigation protection and trusted external-link handling.

Why

Generated HTML should behave like a reopenable artifact without letting model-authored scripts inherit application privileges or silently contact external hosts. The previous streaming and settled states also used different controls, which caused expansion and multi-artifact state bugs.

How it was verified

  • pnpm test — 291 passed, 7 skipped
  • pnpm build
  • Component coverage for streaming expansion, settled reopen/close state, panel resizing, and cleanup
  • Electron navigation-policy and HTML-sanitization/CSP coverage
  • git diff --check codex/provider-configuration..HEAD

Screenshots (UI changes)

The artifact flow was manually exercised in the local Electron app during PR #74. This split retains only the HTML artifact implementation and its security boundary.

Checklist

  • pnpm typecheck and pnpm test pass locally
  • New behavior includes component and Electron policy tests
  • No dist-server/ edits or dependency/lockfile churn
  • macOS-only behavior remains Electron-gated
  • Model-authored scripts cannot make outbound requests from the preview

Stack

This fork-based stack targets upstream main; this PR will be rebased after #93 lands so its visible diff collapses to this slice.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zenacquire, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b69b5b8-baf8-4dc5-9c6c-b0e933102a8f

📥 Commits

Reviewing files that changed from the base of the PR and between 8490f3a and b37c184.

📒 Files selected for processing (32)
  • README.md
  • electron/main.mjs
  • electron/navigation-policy.mjs
  • electron/navigation-policy.test.mjs
  • server/config.test.ts
  • server/config.ts
  • server/drivers/acp/acp.test.ts
  • server/drivers/builtIn.ts
  • server/drivers/ollama-cloud.ts
  • server/drivers/openai-compatible.test.ts
  • server/drivers/openai-compatible.ts
  • server/drivers/openai-endpoint.ts
  • server/drivers/openrouter.ts
  • server/index.test.ts
  • server/index.ts
  • server/testing/fake-acp-cli.ts
  • src/components/ApiKeys.tsx
  • src/components/ArtifactPanel.test.tsx
  • src/components/ArtifactPanel.tsx
  • src/components/ChatMarkdown.test.tsx
  • src/components/ChatMarkdown.tsx
  • src/components/ChatView.tsx
  • src/components/Onboarding.tsx
  • src/components/OpenAIEndpointFields.tsx
  • src/components/ProviderIcons.tsx
  • src/components/ProviderSetupOptions.test.tsx
  • src/components/ProviderSetupOptions.tsx
  • src/components/SettingsModal.tsx
  • src/lib/html-artifacts.test.ts
  • src/lib/html-artifacts.ts
  • src/state/store.tsx
  • vite.config.ts

Comment @coderabbitai help to get the list of available commands.

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