Document and bound native tool payload envelopes and oversized direct-call failure behavior

Abierto
#233 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start with src/wasm_sandbox/src/lib.rs and src/hyperlight_sandbox/src/tools.rs, then inspect the fixed-revision probe_hyperlight_host_tools.py harness and its native dispatcher entry point. Determine which layer can define the request, response, and refusal-envelope contract, and add or document boundary coverage for malformed, escaped, exact, and oversized inputs. Done means the supported limits and unrecoverable behavior are explicit and reproducible.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem

An embedding host needs a supported way to determine native tool request/response limits and handle oversized direct guest calls. Checking an argument in the host callback is too late if marshalling fails before that callback is reached. Checking only a Python guest helper is bypassable by guest code calling the native dispatcher directly.

The two directions have different limits, and JSON escaping plus lower-level framing make a single character count or fixed overhead allowance insufficient. This request concerns the physical envelope and failure contract; host authorization and application budgets remain the embedding application's responsibility.

Environment and measured evidence

  • hyperlight-sandbox==0.7.0, hyperlight-sandbox-backend-wasm==0.7.0, hyperlight-sandbox-python-guest==0.7.0.
  • Windows 11 x86-64/WHP, host Python 3.13.12, packaged Python guest, 400 MiB heap, 200 MiB stack, HYPERLIGHT_MAX_SURROGATES=0, a bounded disposable native worker.
  • The following are historical measurements from 2026-10-02, not promised limits or new measurements from 2026-10-03.

For a registered maf_dispatch(payload: str) callback, the guest sends a JSON string containing a tool name and arguments. Request payloads of 12,044, 16,044 and 16,144 UTF-8 bytes reached the parent callback. A request with a 16,200-character ASCII value instead caused worker-pipe EOF before the parent callback observation. Workers were reaped. These observations do not establish the exact maximum or prove which lower-level framing operation failed.

Host responses of 8,000, 16,300, 20,000, 64,000, 256,000 and 400,000 ASCII characters round-tripped in the bounded experiment. Those tests intentionally bypassed the application's conservative response cap to measure the SDK; they are not production-safe ceiling declarations. An escaped/Unicode response needed a different number of bytes when serialized again as a native JSON string.

The audited Wasm implementation configures the guest input buffer from config.heap_size.min(70_000_000). That allocation request does not itself define a supported usable application payload limit. The registry's argument-size check runs after arguments have reached dispatch, so it cannot by itself address failures before dispatch.

Reproduction

The bounded harness at a fixed revision registers the synthetic dispatcher, runs each size in a fresh contained worker, counts UTF-8 payload and IPC-envelope bytes, and records callback arrival and worker retirement. Its guest facade serializes the request and calls the native dispatcher; it does not enforce an application-length check before that call.

From that repository revision on a suitable WHP host, after uv sync --locked:

uv run python scripts/probe_hyperlight_host_tools.py --live --case native-request-16100 --case native-request-16200 --output native-envelope-probe.json

Use a fresh output filename and retain the contained worker boundary; the upper case may terminate native execution. The validator rejects unexpected EOF below the previously observed failing value size. A 2026-10-03 rerun of these two cases failed during native initialization with memory-allocation errors, so neither exercised the intended boundary. Those incomplete results were rejected; they do not confirm or revise the historical size observations. Linux behavior was not measured by these Windows runs.

Requested contract

Please document or expose supported complete-envelope limits for native tool requests, responses and error/refusal responses, and specify the bounded failure behavior for malformed or oversized direct guest calls.

  • State how callers account for framing, UTF-8, escaping and serialization expansion for the selected buffer configuration.
  • Where possible, reject an oversized request before unsafe native marshalling, including calls that bypass a convenience helper.
  • If recoverable refusal is not supported, document the resulting failure and whether the host must retire the sandbox/worker. A bounded, explicit unrecoverable outcome can be integrated; it must not be presented as a recoverable application refusal.
  • Exercise just-below, exact and just-above supported limits, malformed input, escaping and refusal envelopes. Distinguish failure to initialize from an exercised transport boundary.
  • Identify any lower-layer issue or API that should own the guarantee. If the existing implementation already has a sufficient contract, documentation and reproducible evidence may resolve this without a runtime change.

Simply increasing a buffer, checking only inside the host callback, or asserting a universal approximately 16 KiB cap would not answer the integration question. The embedding application will retain its own worker deadline, revocation and cleanup checks.

Detailed measurements and scope. Downstream adoption tracker: https://github.com/sokolaidev/maf-extensions/issues/1689. This request does not claim a host escape or production native host-tool qualification.

Related request: https://github.com/hyperlight-dev/hyperlight-sandbox/issues/232. Publication confirmation and physical-envelope behavior are separate contracts.

Lenguaje dominante
Rust
Estrellas
83
Forks
8
Merge medio
2 d 20 h
PR fusionados (30 d)
29

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de hyperlight-dev/hyperlight-sandbox

Todos los issues de hyperlight-dev/hyperlight-sandbox

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.