Spaces:
Runtime error
Runtime error
tao-shen Claude Opus 4.6 commited on
Commit ·
ce71ed6
1
Parent(s): 7b4c5b7
fix: add 'unsafe-inline' to CSP script-src for token injection
Browse filesThe injected <script> tag that sets window.__OPENCLAW_AUTH_TOKEN__ was
blocked by CSP script-src 'self'. Without 'unsafe-inline', the inline
script never executes — so in incognito mode (no localStorage), the
token is never set and WebSocket auth fails.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
patches/hf-spaces-allow-iframe-embedding.patch
CHANGED
|
@@ -1,16 +1,18 @@
|
|
| 1 |
diff --git a/src/gateway/control-ui-csp.ts b/src/gateway/control-ui-csp.ts
|
| 2 |
-
index 8a7b56f..
|
| 3 |
--- a/src/gateway/control-ui-csp.ts
|
| 4 |
+++ b/src/gateway/control-ui-csp.ts
|
| 5 |
-
@@ -7,
|
| 6 |
"default-src 'self'",
|
| 7 |
"base-uri 'none'",
|
| 8 |
"object-src 'none'",
|
| 9 |
- "frame-ancestors 'none'",
|
|
|
|
| 10 |
+ "frame-ancestors 'self' https://huggingface.co https://*.hf.space",
|
| 11 |
-
|
| 12 |
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
|
| 13 |
"img-src 'self' data: https:",
|
|
|
|
| 14 |
diff --git a/src/gateway/control-ui.ts b/src/gateway/control-ui.ts
|
| 15 |
index ed7b733..7cc0ab9 100644
|
| 16 |
--- a/src/gateway/control-ui.ts
|
|
|
|
| 1 |
diff --git a/src/gateway/control-ui-csp.ts b/src/gateway/control-ui-csp.ts
|
| 2 |
+
index 8a7b56f..62b0dfd 100644
|
| 3 |
--- a/src/gateway/control-ui-csp.ts
|
| 4 |
+++ b/src/gateway/control-ui-csp.ts
|
| 5 |
+
@@ -7,8 +7,8 @@ export function buildControlUiCspHeader(): string {
|
| 6 |
"default-src 'self'",
|
| 7 |
"base-uri 'none'",
|
| 8 |
"object-src 'none'",
|
| 9 |
- "frame-ancestors 'none'",
|
| 10 |
+
- "script-src 'self'",
|
| 11 |
+ "frame-ancestors 'self' https://huggingface.co https://*.hf.space",
|
| 12 |
+
+ "script-src 'self' 'unsafe-inline'",
|
| 13 |
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
|
| 14 |
"img-src 'self' data: https:",
|
| 15 |
+
"font-src 'self' https://fonts.gstatic.com",
|
| 16 |
diff --git a/src/gateway/control-ui.ts b/src/gateway/control-ui.ts
|
| 17 |
index ed7b733..7cc0ab9 100644
|
| 18 |
--- a/src/gateway/control-ui.ts
|