Files
orca/mobile/modules/orca-mobile-web-shell/ios/MobileWebShellResponseHeaders.swift
Kelvin Amoaba f375aba997 fix(mobile): make chat report buttons work in an isolated frame (#42954)
* fix(mobile): run chat report scripts in an isolated shell frame

* fix(mobile): theme chat visuals at handoff and pin the iOS frame to Android's

* test(mobile): probe the page origin by absolute URL from the visual
2026-11-16 06:12:04 +00:00

26 lines
974 B
Swift

/// CSP belongs only on the document response; it is inert on subresources.
enum MobileWebShellResponseHeaders {
static func forPath(
_ path: String,
contentType: String,
byteCount: Int
) -> [String: String] {
var headers = [
"Content-Type": contentType,
"Content-Length": String(byteCount),
"Cache-Control": "no-store",
"X-Content-Type-Options": "nosniff"
]
if path == "/" {
headers["Content-Security-Policy"] = MobileWebShellCsp.header
// HTTPS images can expose session identity: Android uses a hashed host, iOS the verbatim id.
// WebKit srcdoc images leaked the embedder origin despite iframe referrerPolicy; set the document header.
headers["Referrer-Policy"] = "no-referrer"
} else if path == MobileWebShellChatVisualFrame.path {
headers["Content-Security-Policy"] = MobileWebShellChatVisualFrame.csp
headers["Referrer-Policy"] = "no-referrer"
}
return headers
}
}