diff --git a/pkgs/id/crates/id-worlds/src/world_native.rs b/pkgs/id/crates/id-worlds/src/world_native.rs index 44ffca8143..6ca9430066 100644 --- a/pkgs/id/crates/id-worlds/src/world_native.rs +++ b/pkgs/id/crates/id-worlds/src/world_native.rs @@ -14,8 +14,10 @@ //! trap. //! //! Unlike Wasm, the guarantee is the OS sandbox, not an import-free format: -//! native modules are admin-installed and opt-in (`--world-native`), and are -//! never offered for peer download. +//! native modules are admin-installed and opt-in (`--world-native`). +//! A native module stays downloadable by join-capability holders like any +//! active module: download is not install (install needs an admin token +//! plus a native-enabled server), and guest code cannot invoke a download. use std::io::{Read, Write}; use std::os::fd::OwnedFd; diff --git a/pkgs/id/crates/id-worlds/src/world_session/service.rs b/pkgs/id/crates/id-worlds/src/world_session/service.rs index 4db30c97e2..e233236fa0 100644 --- a/pkgs/id/crates/id-worlds/src/world_session/service.rs +++ b/pkgs/id/crates/id-worlds/src/world_session/service.rs @@ -722,8 +722,11 @@ impl WorldService { } } - // Native workers are never offered for peer download: only the Wasm - // tier gets pinned in the blob store. + // Native workers are not pinned in the blob store the way the Wasm + // tier is; a native module is still downloadable by + // join-capability holders via the module-directory fallback in + // `module_bytes` — download is not install (install needs an + // admin token plus a native-enabled server). let blobs = self.blobs.as_ref().ok_or(InstallError::Disabled)?.clone(); let pin = (!is_native).then(|| { blobs @@ -904,7 +907,9 @@ impl WorldService { } /// Read the currently pinned module artifact for peer download. - /// The caller must already have authenticated as a world participant. + /// The caller must already have authenticated as a world participant + /// (a join-capability holder); guest program code cannot invoke a + /// download — only session frames can. /// /// Falls back to the module directory when there is no blob pin to /// serve from. A read-only replica clears its blob store so module @@ -959,8 +964,9 @@ impl WorldService { .parse() .map_err(|_| InstallError::InvalidUpload)?; // Wasm installs are pinned in the blob store; native installs are - // saved only in the module directory (they are never offered for - // peer download), so a stored native module is read from there. + // saved only in the module directory and served from there for + // join-capability-holder downloads (download is not install: + // install needs an admin token plus a native-enabled server), if let Some(blobs) = self.blobs.as_ref() && let Ok(bytes) = blobs.blobs().get_bytes(hash).await && bytes.len() <= MAX_WORLD_MODULE_BYTES