feat(supervisor): stream HTTP session hook uploads on the plain-HTTP forward proxy

Abierto
#5,086 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
32/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start by reading ForwardMiddlewarePipeline::apply in crates/openshell-supervisor-network/src/proxy.rs and compare it with how request_body_delivery(config) in l7/relay.rs picks a delivery per route. Read docs/extensibility/supervisor-middleware/operations.mdx for the current 4 MiB wording. Write the forward-proxy denial test first (body_over_limit, upstream sees nothing), then stream middleware output for routes that need no body-wide work. Done means the new tests pass and the limits text matches actual behavior.

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

Descripción

User Story

As an operator running an HTTP session hook that streams request bodies (for example a signing or redaction stage), I want plain-HTTP requests sent through the forward proxy to behave like requests on the L7 relay, so that uploads larger than 4 MiB are not denied depending on how the sandbox reached the endpoint.

Problem Statement

HTTP session hooks have no total size cap on STREAM request bodies on the L7 relay paths. The plain-HTTP forward proxy (ForwardMiddlewarePipeline::apply in crates/openshell-supervisor-network/src/proxy.rs) always passes RequestBodyDelivery::WITHHOLD, because it writes the request upstream as one buffer. The preflight therefore advertises limits.max_output_body_bytes of 4 MiB (MAX_MIDDLEWARE_PAYLOAD_BYTES), and a larger upload that matches a session request hook fails with failure_code: body_over_limit.

The limit is documented in Supported Operations (forward-proxy requests buffer output, 4 MiB), but the same hook behaves differently depending on the path a request takes. There is also no test covering the forward-proxy denial.

Raised in review of #4359: https://github.com/NVIDIA/OpenShell/pull/4359#discussion_r4381863330

Impact / Why This Matters
  • Inconsistent behavior for one middleware config: an upload over 4 MiB succeeds via the L7 relay and fails via the forward proxy.
  • It undercuts the "no total size cap" goal of HTTP session hooks for clients that use HTTP_PROXY with plain HTTP.
Proposed Design
  1. Add a test now: a forward-proxy upload over 4 MiB that matches a session request hook is denied with failure_code: body_over_limit, and the upstream sees nothing.
  2. Stream middleware output on the forward proxy, like the REST relay, when the route needs no body-wide work (no SigV4 signing, body credential rewrite, or body-aware L7 re-evaluation such as JSON-RPC/MCP/GraphQL). Keep WITHHOLD with its route limit for those cases.
  3. Update the Supported Operations limits text once forward-proxy streaming lands.
Acceptance Criteria
  • A test covers the 4 MiB forward-proxy denial (body_over_limit, nothing forwarded).
  • A plain-HTTP forward-proxy upload over 4 MiB through a STREAM session request stage succeeds on routes that need no body-wide work, with max_output_body_bytes unset in the preflight.
  • Routes that still need the whole body keep their documented limits.
  • Docs describe the forward-proxy behavior.
Alternatives Considered
  • Keep buffering and only document the limit. That leaves the path-dependent behavior in place.
Agent Investigation
  • proxy.rs ForwardMiddlewarePipeline::apply calls apply_request_with_delivery(..., RequestBodyDelivery::WITHHOLD) with the comment "The forward proxy writes the request as one buffer, so middleware output is withheld and inlined."
  • The L7 REST relay chooses delivery per route via request_body_delivery(config) in l7/relay.rs.
  • Docs: docs/extensibility/supervisor-middleware/operations.mdx (request output buffering paragraph) already lists the forward proxy among buffered paths.
Lenguaje dominante
Rust
Estrellas
20.6k
Forks
2k
Merge medio
2 d 14 h
PR fusionados (30 d)
275

Preparar el entorno

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 NVIDIA/OpenShell

Todos los issues de NVIDIA/OpenShell

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.