Security: Unsafe HTML iframe sandbox configuration allows same-origin access#1223
Conversation
The LiveBrowserView component uses `sandbox="allow-scripts allow-same-origin allow-forms"` on an iframe. The combination of `allow-scripts` and `allow-same-origin` effectively removes most sandbox protections, allowing the embedded content to access the parent's cookies, storage, and DOM if same-origin. Additionally, `allow-forms` enables form submission. The stream token is passed via URL fragment, which while keeping it out of server logs, is still accessible to JavaScript in the iframe. If the nekoUrl is ever same-origin or becomes same-origin through DNS hijacking, this creates a significant attack surface. Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
👋 Thanks for the PR! This one targets See CONTRIBUTING.md for the branch model. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changesiframe Sandbox Hardening
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Note Your trial team has used its Gitar budget, so automatic reviews are paused. Upgrade now to unlock full capacity. Comment "Gitar review" to trigger a review manually. Code Review ✅ ApprovedRemoves the unsafe 'allow-same-origin' directive from the iframe sandbox configuration in LiveBrowserView to prevent unauthorized access to parent cookies and DOM. This hardens the browser component against potential cross-origin attacks. OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Important Your trial ends in 6 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more. Was this helpful? React with 👍 / 👎 | Gitar |
…ifest/install-registry) + neko #1223 blocked on #71 Pi browser node
|
Thanks for this, good catch and a fair hardening. We brought up a live Neko session and traced the client: auth runs through URL query params into the WebSocket handshake, with no cookie or same-origin dependency on the connection path, so dropping allow-same-origin keeps login and the WebRTC stream working. The only effect is that a couple of non-essential UI preferences stop persisting, which is an acceptable trade for the tighter sandbox. Merging it. Appreciate the contribution. |
…, tested, merged), white-screen diagnosed (not #1223, pre-existing render), next = browser redesign #66 + render fix #71
Summary
Security: Unsafe HTML iframe sandbox configuration allows same-origin access
Problem
Severity:
High| File:desktop/src/apps/BrowserApp/LiveBrowserView.tsx:L22The LiveBrowserView component uses
sandbox="allow-scripts allow-same-origin allow-forms"on an iframe. The combination ofallow-scriptsandallow-same-origineffectively removes most sandbox protections, allowing the embedded content to access the parent's cookies, storage, and DOM if same-origin. Additionally,allow-formsenables form submission. The stream token is passed via URL fragment, which while keeping it out of server logs, is still accessible to JavaScript in the iframe. If the nekoUrl is ever same-origin or becomes same-origin through DNS hijacking, this creates a significant attack surface.Solution
Remove
allow-same-originfrom the sandbox attribute unless absolutely required. If cross-origin communication is needed, usepostMessagewith strict origin validation instead. Consider usingallow-same-originonly withallow-scriptsremoved, or use a more restrictive sandbox. Ifallow-same-originis required for functionality, document the security trade-off and ensure the nekoUrl is always on a separate, dedicated origin with no sensitive cookies.Changes
desktop/src/apps/BrowserApp/LiveBrowserView.tsx(modified)Summary by CodeRabbit