You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e4bf6fa
Browse filesBrowse the repository at this point in the historyBrowse files
mobile: sandboxed HTML apps — app card, sandbox WebView, NIP-11 door discovery
- imeta `x` / `preview-light` / `preview-dark`; `MessageMediaKind.app`
(= text/html + a lowercase 64-hex hash)
- AppCard: theme-matched static preview, Run, Download, sender in the chrome;
never in clamped previews
- AppWebViewPage: CupertinoPageRoute, `loadRequest` with the Authorization
header (never a URL token), navigation locked to the initial URL, no
JavaScript channels, error + retry states
- relay_info: NIP-11 `app_content_url` with the desktop's validation (bare
origin, relay hostname, distinct origin), re-asked on every reconnect,
remembered per relay; null = HTML stays a link
- signAppContentAuth: blob-scoped kind-24242 token, 300 s, no `server` tag,
minted fresh per Run
- iOS: NSAllowsLocalNetworking (WKWebView obeys ATS); SandboxWebViewHardening
swizzles WKWebView.load(_:) to register the document-start WebRTC/sendBeacon
removal script for /app/<sha>.html requests — webview_flutter exposes no
user-script API and WebKit ignores CSP `webrtc 'block'`
- Pretendard 1.3.9 (OFL) bundled as a font family
- dev_push_lease: widen the exact NIP-11 allowlist (app_content_url,
admin_api, gif) — advertising the door made the push descriptor
unparseable and silently disabled push discovery on mobile
- docs: mobile section rewritten — code on the mac mini, build and verify
on the Intel Mac + iPad
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UAm5qbNPszvcwnMMbfGVGa
Signed-off-by: dhseo <[email protected]>
Copy file name to clipboardExpand all lines: docs/sandboxed-apps.md
+44-51Lines changed: 44 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ Three independent layers; any one failing leaves the other two:
19
19
| Layer | Where | What it guarantees |
20
20
|---|---|---|
21
21
| Response CSP `sandbox allow-scripts; default-src 'none'; connect-src 'none'; webrtc 'block'; …`| relay app door **and** re-stamped by the desktop proxy | opaque origin, no fetch/XHR/WS/beacon, no forms, no plugins. **WebKit ignores `webrtc 'block'`** — see the subframe script below |
22
-
| Subframe script | desktop `sandbox_frame_hardening.rs` (`initialization_script_for_all_frames`)| in every non-main frame,`RTCPeerConnection` & co. are undefined and `sendBeacon` returns false before app code runs; properties are non-configurable. Observed before the fix: ICE gathering reached a public STUN server from inside the sandbox |
22
+
| Subframe script | desktop `sandbox_frame_hardening.rs` (`initialization_script_for_all_frames`); mobile `ios/Runner/SandboxWebViewHardening.swift` (document-start `WKUserScript`, all frames of the sandbox web view) |`RTCPeerConnection` & co. are undefined and `sendBeacon` returns false before app code runs; properties are non-configurable. Observed before the fix: ICE gathering reached a public STUN server from inside the sandbox |
23
23
| Embedder sandbox | desktop `<iframe sandbox="allow-scripts">`; mobile `NavigationDelegate`| survives in-frame navigation; no top navigation, popups, downloads, forms |
24
24
| Navigation lock | desktop `navigation_policy.rs` (`WebviewWindowBuilder::on_navigation`), parent CSP `frame-src buzz-media:`; mobile: every request after the first is `prevent`| a frame cannot carry data out by navigating itself to an external URL |
25
25
@@ -107,55 +107,48 @@ Report back by cross-session message to the mac-mini session (it shows as
107
107
"buzz 웹앱 구현" in your ListAgents) with one line per item 2–6 and the run id
108
108
from item 5. Then continue with the mobile checklist below.
109
109
110
-
## Mobile — checklist for the Intel-Mac session (real iPad)
111
-
112
-
Do not build or run the Flutter app on the M-series dev Mac; verify on a
113
-
physical iPad from the Intel Mac session.
114
-
115
-
**Assignment (2026-09-05):** items 1–8 below are the Intel-Mac session's work
116
-
— `mobile/` has no changes on this branch yet, so implementation comes first.
117
-
Test fixtures are already in `#test`: an archify sequence app with light/dark
118
-
previews, `sandbox-probe.html`, and a listener-targeted `sandbox-net-probe.html`.
119
-
Relay: `ws://192.168.1.99:3000`, app door `http://192.168.1.99:3001`.
`NavigationDelegate.onNavigationRequest` returns `prevent` for anything
142
-
but the initial URL, top bar with sender + "sandbox" + close.
143
-
7. Bundle Pretendard (same release as the desktop/skill assets) as a Flutter
144
-
font family for future SVG previews.
145
-
7b. **WebKit ignores the CSP `webrtc 'block'` directive** — on the desktop
146
-
the probe reached a public STUN server over UDP from inside the sandbox
147
-
until a user script removed WebRTC. Add a document-start `WKUserScript`
148
-
(webview_flutter: `runJavaScript` is too late; use the platform
149
-
`WKUserScript` injection) that defines `RTCPeerConnection`,
150
-
`webkitRTCPeerConnection`, `RTCDataChannel` & co. as non-configurable
151
-
`undefined` and makes `navigator.sendBeacon` return `false`. Mirror
152
-
`desktop/src-tauri/src/sandbox_frame_hardening.rs`; the mobile page is the
153
-
top frame, so apply it unconditionally (no `window.top === window` guard).
154
-
Probe row 9 (`RTCPeerConnection + ICE gather`) is the check.
155
-
8. On the iPad: (a) an archify app renders and is interactive; (b) the probe
156
-
page below shows every escape as blocked; (c) link taps, `window.open`,
157
-
form submits do nothing; (d) no ATS error/blank page over
158
-
`http://<lan-ip>:3001`; (e) reopening after 10 minutes mints a fresh token.
110
+
## Mobile — code on the mac mini, build and verify on the Intel Mac (real iPad)
111
+
112
+
The M-series dev Mac has no Flutter toolchain or pub cache, so the mobile
113
+
code is written there and **analyzed, built, installed and verified from the
114
+
Intel-Mac session** on a physical iPad. Test fixtures are in `#test`: an
115
+
archify sequence app with light/dark previews, `sandbox-probe.html`, and a
app door `http://192.168.1.99:3001`.
| App card: theme-matched preview (`Theme.of(context).brightness`), Run, Download, sender in the chrome. Never in clamped previews (`maxLines`) |`mobile/lib/features/channels/message_content/app_card.dart`, wired from `message_content.dart` (`_buildAppCard`, for both `[…]()` and `![…]()` syntax) |
125
+
| NIP-11 `app_content_url` discovery with the desktop's validation (bare origin, relay hostname, distinct origin); re-asked on every reconnect; remembered per relay so a community switch cannot reuse another relay's door |`mobile/lib/shared/relay/relay_info.dart` — `appContentUrlProvider`, null = HTML stays a link |
126
+
| Blob-scoped token: `t=get`, `x`, `expiration = now + 300 s`, **no `server` tag**, minted fresh on every Run (never memoized) |`mobile/lib/shared/relay/media_auth.dart``signAppContentAuth`|
127
+
| Sandbox page: `CupertinoPageRoute` (slides in from the right, like the desktop drawer; stacks inside the pane in the wide shell), `loadRequest(uri, headers: {Authorization})`, JS unrestricted, **no JavaScript channels**, `onNavigationRequest` allows the initial URL only, error + retry states |`mobile/lib/features/channels/app_webview_page.dart`|
128
+
| ATS: `NSAppTransportSecurity → NSAllowsLocalNetworking = true` (WKWebView obeys ATS; the Dart client does not) |`mobile/ios/Runner/Info.plist`|
129
+
| WebRTC + `sendBeacon` removal. `webview_flutter` has no user-script API, so `WKWebView.load(_:)` is swizzled: a request for `/app/<sha256>.html` registers the document-start script (all frames) on that web view before the navigation starts. The script itself no-ops for a top-level document outside that path |`mobile/ios/Runner/SandboxWebViewHardening.swift`, installed from `AppDelegate`|
130
+
| Pretendard 1.3.9 (OFL) as a Flutter font family |`mobile/pubspec.yaml`, `mobile/assets/fonts/Pretendard-*.otf`|
131
+
| NIP-11 allowlist widened with `app_content_url`, `admin_api`, `gif`. The push descriptor parser rejects any unknown top-level NIP-11 field, so advertising the door would otherwise have silently disabled push on mobile |`mobile/lib/shared/push/dev_push_lease.dart`|
`NSAppTransportSecurity/NSAllowsLocalNetworking`. If the WebView still
142
+
refuses `http://<lan-ip>:3001` (blank page, ATS error in the console), that
143
+
iOS does not treat a raw private IP as local networking — add an
144
+
`NSExceptionDomains` entry for the relay host instead.
145
+
4. On the iPad: (a) an archify app renders and is interactive; (b) the probe
146
+
page below shows every escape as blocked — row 9 (`RTCPeerConnection`) is
147
+
the native script; (c) link taps, `window.open`, form submits do nothing;
148
+
(d) no ATS error/blank page over `http://<lan-ip>:3001`; (e) reopening
149
+
after 10 minutes mints a fresh token; (f) the listener-targeted net probe
150
+
with the `3999`/`3478` listeners up on the mac mini reports zero hits
151
+
(send the run id and time); (g) light/dark preview follows the app theme.
159
152
160
153
## Sandbox probe
161
154
@@ -171,4 +164,4 @@ Pretendard (OFL) is the one fixed face:
171
164
- archify skill `scripts/embed-fonts.mjs`: subsets the woff2 to the
172
165
characters used and inlines it into the HTML (the sandbox blocks font
173
166
downloads).
174
-
- Mobile: bundle the same release.
167
+
- Mobile: bundled as the `Pretendard` font family (same 1.3.9 release).
Copy file name to clipboardExpand all lines: mobile/ios/Runner/Info.plist
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,13 @@
51
51
<string>Buzz uses Face ID to confirm sensitive identity transfers.</string>
52
52
<key>NSLocalNetworkUsageDescription</key>
53
53
<string>Buzz uses your local network to connect to relays hosted on devices near you, such as during development. Remote messaging does not require this access.</string>
54
+
<key>NSAppTransportSecurity</key>
55
+
<dict>
56
+
<!-- WKWebView obeys ATS (the Dart http client does not). Sandboxed apps
57
+
are served over plain HTTP from the relay's LAN app door. -->
58
+
<key>NSAllowsLocalNetworking</key>
59
+
<true/>
60
+
</dict>
54
61
<key>NSCameraUsageDescription</key>
55
62
<string>Buzz uses the camera to take profile photos and animated avatars, attach photos to messages, and scan QR codes for device pairing.</string>
0 commit comments