Skip to content

feat(security): enforce fail-closed capability-based security across Web, Android, iOS, and CLI - #103

Merged
jbingham merged 2 commits into
mainfrom
feat/capabilities-security
Nov 16, 2026
Merged

jbingham merged 2 commits into
mainfrom
feat/capabilities-security

Conversation

@jbingham

Copy link
Copy Markdown
Collaborator

Summary

Implements fail-closed Capability-Based Security (ThreeLiveCapabilities) across Web (three-live + xr-live), Android (mobile/android), iOS/visionOS (mobile/ios), and three-live-cli static HTML linting (compiler/).

Canonical Capabilities (9)

  • scripts: Compiling or executing <script type="text/three"> / executeScript() (legacy allow-client-scripts remains supported as an alias on Web; enabled by default in native ThreeLiveCapabilities.DEFAULT / .default for in-memory Boa compilation, disabled in .NONE / .zero).
  • network: Outbound fetch, WebSocket, and WebRTC signaling connections, with scheme and origin allowlist support (network:https,wss@https://cdn.example.com).
  • remote_content: Remote .glb, .usdz, script-src, HDRI environment/skybox maps, texture-pack, external gltf.images[].uri, .splat/.spz Gaussian splat clouds, and remote spatial audio URLs (also requires network for network schemes; local blob:, data:, file:, asset:, and content: URIs remain local).
  • camera: Immersive AR passthrough sessions, viewport frame capture (captureViewFrame, WebMCP capture_xr_view, RendererFrameSource, ARViewFrameSource, Gemini Live frame streaming), and object detection loops.
  • microphone: Speech recognition (startVoiceEdit, holdToAsk), realtime voice sessions (AIVoiceSession), Gemini Live PCM audio input, and shared-room-voice WebRTC signaling.
  • sensors: Immersive VR sessions, WebXR/ARCore/ARKit plane, mesh, and depth reads, WebMCP pose/gaze/depth tools, and 25-joint hand pose/gesture polling.
  • storage: Persistent anchor reads/writes (localStorage, #xr-state URL hashes) and AI texture disk/IndexedDB caches.
  • ai: LLM scene editing (editScene), image-to-scene (compileFromImage), Talk-to-Select Tier-2 model fallback, AI texture generation (generateTextures), and Gemini Live / realtime voice sessions.
  • external_handoff: Launching external OS AR viewers (Apple AR Quick Look and Google ARCore Scene Viewer).

Key Details

  • Presets & Negation: Supports none, viewer (network remote_content camera external_handoff), all, and -<cap> negations (capabilities="all -ai -microphone").
  • No Scene Self-Escalation: Untrusted scripts and glTF extras.xr traits cannot grant capabilities omitted by the host embedder; denied operations emit credential-, query-, and fragment-stripped three-capability-denied (CapabilityDeniedEvent on Android/iOS) diagnostics with 60 Hz frame-loop deduplication while geometry continues to render cleanly.
  • Static HTML Linting (three-live-cli validate): Updates TL401 to accept capabilities="scripts" / capabilities="all" and adds TL403 warnings when <three-live> / <xr-live> attributes or inline userData.xr.* traits require capabilities omitted from the host tag.

Verification

  • node scripts/build.js (all 23 Web bundles within gzip budgets)
  • node scripts/build.js --test (all 42 Web test suites passing, including new capabilities_test and xr_capabilities_test)
  • cargo test --release (all 188 Rust compiler & linter tests passing)
  • Android JVM (ThreeLiveCapabilitiesTest + all 13 suites) & iOS/visionOS (ThreeLiveCapabilitiesTests + Swift compiler/demo build tests) passing

…Web, Android, iOS, and CLI

Untrusted or AI-authored 3D and XR scenes can embed declarative `userData.xr` traits, external glTF image/splat/audio URIs, or host attributes that trigger outbound network connections, camera/viewport capture, microphone streaming, spatial sensor reads, persistent storage writes, LLM calls, or external OS AR handoffs without explicit host opt-in.

Gate all sensitive host side effects across Web (`<three-live>` and `<xr-live>`), Android (`ThreeLiveCapabilities`), iOS/visionOS (`ThreeLiveCapabilities`), and `three-live-cli` static HTML validation (`TL401` and `TL403`) behind nine canonical capabilities (`scripts`, `network`, `remote_content`, `camera`, `microphone`, `sensors`, `storage`, `ai`, and `external_handoff`):

- Default all capabilities to disabled on Web (`CAPABILITIES_NONE`, keeping legacy `allow-client-scripts` as an alias for `scripts`) and default all capabilities except in-memory Boa `scripts` to disabled on Android and iOS (`ThreeLiveCapabilities.DEFAULT` / `.default`).
- Support presets (`none`, `viewer`, `all`), `-<cap>` negations, and scheme/origin network allowlists (`network:https,wss@https://cdn.example.com`) while permitting local `blob:`, `data:`, `file:`, `asset:`, and `content:` URIs without network access.
- Emit credential-, query-, and fragment-stripped `three-capability-denied` / `CapabilityDeniedEvent` diagnostics with frame-loop deduplication so denied traits degrade gracefully without breaking scene rendering.
@jbingham
jbingham merged commit 2356a45 into main Nov 16, 2026
12 checks passed
@jbingham
jbingham deleted the feat/capabilities-security branch November 16, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants