Skip to content

fix(security): put every trust decision on a host-owned token surface - #30710

Merged
nwparker merged 2 commits into
mainfrom
nwparker/dialog-security-surface
Oct 19, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/dialog-security-surface

Conversation

@nwparker

@nwparker nwparker commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​61 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​61
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​266 $\color{#cf222e}{\Huge{\mathbf{−}}}$​224 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42

ELI5

Screens that ask you to trust or run code (repo hooks, notebook runs, plugin installs and approvals, agent command approvals, certificate overrides) should always look like Orca, never like a plugin wants them to. Only some of them were protected that way. Now all of them are, through one setting on the dialog.

What Changed

  • DialogContent gets surface="security", which applies the existing host-owned token set (plugin-security-chrome), and a scrollable prop for dialogs whose whole body scrolls.
  • Every trust dialog uses it: orca.yaml hook trust, notebook run, plugin consent, install, marketplace preview and source, remove and rollback. Before, only some plugin dialogs applied the class by hand and the orca.yaml and notebook dialogs did not.
  • Trust decisions outside a dialog get the same protection through a small SecuritySurface wrapper: the agent command Allow/Deny card in native chat and the browser's "proceed past certificate error" override. (Their diffs look large only because the markup is re-indented under the wrapper.)
  • A test lists every trust dialog and inline trust surface, and fails if one stops using the surface.
  • docs/STYLEGUIDE.md documents the rule.

Today the visual result is identical, because nothing restyles these tokens yet.

Why

Upcoming plugin app themes override the app's color tokens. A dialog that approves code must not inherit them: a theme could make the confirm button invisible or the warning unreadable. Making it one prop on the shared dialog, plus a test, keeps the next trust dialog from forgetting.

Linked Issue

N/A (maintainer refactor).

Visual Proof

N/A — no visible change on main (no theme overrides these tokens yet). The protection is shown working under a plugin theme in the stacked theme PR.

Testing

  • New dialog-security-surface.test.tsx; existing dialog and settings suites pass. pnpm tc:web, oxlint, check:code-quality:changed clean.
  • Verified on the stacked theme work: under a hostile theme (root --primary set to pink) the consent dialog keeps host colors.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Behavior-preserving: no change for Linux/Windows/macOS, SSH, mobile, or older clients.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Plugin themes write CSS tokens on the document root, and dialogs portal to
body, so any trust surface without plugin-security-chrome inherits them; a
theme could hide what is being approved. The orca.yaml hook trust dialog,
notebook run confirmation, plugin install, remove and rollback dialogs were
missing it. DialogContent gains surface="security", which applies the
host-owned tokens, and a scrollable prop for the plugin dialogs' existing
viewport-height scrolling; every trust dialog uses the surface and a test
lists them. The style guide says when to use each.
The agent command approval card (Allow/Deny) and the browser certificate
override sit outside a dialog, so plugin theme tokens still reached them.
A SecuritySurface primitive puts its child on the same host-owned token set
as DialogContent surface="security"; both use it, and the security surface
test now lists inline trust surfaces as well as dialogs.
@nwparker nwparker changed the title fix(security): put every trust dialog on a host-owned token surface fix(security): put every trust decision on a host-owned token surface Oct 19, 2026
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

DialogContent adds a security surface and an optional scrollable mode. Trust and approval dialogs adopt the security surface, and several plugin dialogs use the scrollable option. The browser load-failure overlay and native chat approval card are wrapped in SecuritySurface. Tests check the shared class and audit adoption. The style guide documents when to use these options.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 44ded

The trust dialogs now use host-owned colors, but the agent command approval card still takes its background and plan-text colors from the chat palette. A plugin theme could therefore still change how approval content looks. Reset those chat colors on the security surface before relying on this protection.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 13 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the security change: trust decisions now use a host-owned token surface. It is concise and directly matches the pull request changes.
Description check Passed The description includes all required sections and clearly explains the user impact, implementation, rationale, testing, visual proof, compatibility, and checklist status. The maintainer-specific link…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes all required sections and clearly explains the user impact, implementation, rationale, testing, visual proof, compatibility, and checklist status. The maintainer-specific linked issue exception is addressed with an explicit explanation.

Full details: Docstring Coverage

Explanation

Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 13 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9c27c396-89f9-4a28-bcb9-d1f94d587640
📥 Commits

Reviewing files that changed from the base of the PR and between 7cc2859 and 44ded11.

📒 Files selected for processing: 14
  • docs/STYLEGUIDE.md
  • src/renderer/src/components/browser-pane/navigate/browser-load-failure-overlay.tsx
  • src/renderer/src/components/editor/IpynbViewer.tsx
  • src/renderer/src/components/native-chat/NativeChatApprovalCard.tsx
  • src/renderer/src/components/settings/PluginConsentDialog.tsx
  • src/renderer/src/components/settings/PluginInstallDialog.tsx
  • src/renderer/src/components/settings/PluginMarketplacePreviewDialog.tsx
  • src/renderer/src/components/settings/PluginMarketplaceSourceDialog.tsx
  • src/renderer/src/components/settings/PluginRemoveDialog.tsx
  • src/renderer/src/components/settings/PluginRollbackDialog.tsx
  • src/renderer/src/components/sidebar/OrcaYamlTrustDialog.tsx
  • src/renderer/src/components/ui/dialog.tsx
  • src/renderer/src/components/ui/security-surface.test.tsx
  • src/renderer/src/components/ui/security-surface.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Comment on lines +64 to +65
<SecuritySurface>
<div className="min-h-0 shrink overflow-hidden bg-chat-canvas">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Secure the approval card’s chat colors.

When a plugin theme changes the root palette, this wrapper resets base tokens but leaves --chat-canvas and --chat-foreground inherited from the ancestor chat palette. The card uses bg-chat-canvas, and its plan content uses text-chat-foreground. A theme can therefore still change the appearance of content the user must review before approval. Reset the chat palette on this surface, or use host-owned tokens throughout the approval content. (raw.githubusercontent.com)

@nwparker
nwparker merged commit 25e53f4 into main Oct 19, 2026
36 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