fix: configurable CSP frame-ancestors for dashboard embedding#17
Merged
fabianbaier merged 1 commit intoyourclawfrom Mar 3, 2026
Merged
fix: configurable CSP frame-ancestors for dashboard embedding#17fabianbaier merged 1 commit intoyourclawfrom
fabianbaier merged 1 commit intoyourclawfrom
Conversation
The Control UI hardcodes `frame-ancestors 'none'` which blocks iframe embedding. For managed deployments (like YourClaw) where the gateway UI is embedded in a dashboard, this needs to be overridable. Changes: - control-ui-csp.ts: Read OPENCLAW_FRAME_ANCESTORS env var for the frame-ancestors directive, defaulting to 'none' when unset - control-ui.ts: Only set X-Frame-Options: DENY when framing is fully blocked (CSP frame-ancestors takes precedence when configured) - Added patch file in yourclaw-patches/ for reapplying after upstream sync Usage: OPENCLAW_FRAME_ANCESTORS="https://example.com" openclaw gateway run Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
leopold16
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
frame-ancestorsdirective configurable viaOPENCLAW_FRAME_ANCESTORSenv var'none'(no embedding) when unset — preserves upstream security postureX-Frame-Options: DENYwhen custom frame ancestors are configured (CSP takes precedence)yourclaw-patches/for upstream syncWhy
The YourClaw dashboard embeds the gateway Control UI in an iframe ("Legacy Dashboard" tab). The hardcoded
frame-ancestors 'none'+X-Frame-Options: DENYblocks this. The companion backend PR (yourclaw/backend#55) sets the env var in the systemd service.Patch reapplication
The patch is stored at
yourclaw-patches/frame-ancestors-configurable.patchand can be reapplied after upstream syncs:Test plan
frame-ancestors 'none'+X-Frame-Options: DENY(unchanged behavior)OPENCLAW_FRAME_ANCESTORS="https://www.yourclaw.ai"→ allows embedding from that origin🤖 Generated with Claude Code