Skip to content

Latest commit

 

History

History
104 lines (85 loc) · 5.56 KB

README.md

File metadata and controls

104 lines (85 loc) · 5.56 KB

OpenShell request-review middleware (experimental)

This Rust service lets an OpenShell administrator ask a decision model to review outgoing HTTP request content. OpenShell first applies its network policy, then calls this service for traffic selected by the middleware policy. The service returns an allow or deny decision; it does not replace OpenShell's network policy, forward traffic, or grant additional network access.

The service implements OpenShell's EvaluateHttpRequest RPC at PRE_CREDENTIALS. It accepts UTF-8 JSON objects and supports different HTTP methods and routes. It currently returns no request mutations and implements no response or WebSocket inspection. Plain text, multipart uploads and compressed bodies are not supported at this time.

This is separate from Nomos's OpenShell executor. It does not call Nomos Council. Optional context lookup can add retained user context and tool/Council records published by the Relay plugin. Context is disabled by default and is not full conversation history.

Deployment modes: HTTP-only review can run without inbound JWT verification for isolated lab use (loopback, or explicit --allow-insecure-lab on an isolated network). It can also enable gateway JWT verification with native TLS while keeping context lookup disabled. Enabling any context-lookup mode makes native TLS and verified OpenShell extension JWTs mandatory; see the authentication mode table. This remains an experimental integration, not a complete production deployment.

Request flow

Under the sample fail_closed policy, OpenShell enforces network policy, asks Nomos to review selected HTTP requests, and forwards only permitted requests.

For requests selected for review, the supervisor calls Nomos over gRPC before injecting managed credentials. Nomos validates the request, sends the observation and configured questions to the decision model, and applies the configured score thresholds. It returns a decision to OpenShell; the middleware does not forward the workload request.

For requests selected for review, the sample fail_closed policy requires both network-policy permission and a review allow decision before forwarding. With fail_open, an assessment failure can instead let the request continue without an allow decision. A content denial blocks under either setting. OpenShell adds managed credentials where configured and forwards the original payload; Nomos does neither. A network-policy denial stops the request before assessment. See configuration for questions, thresholds and the model API, and lab testing for forwarding evidence.

Read and run

  1. Setup: build, configure a model, register with OpenShell, and select traffic in sandbox policy. For a complete local example, follow the integration lab, including its capture server and Ubuntu 24.04 curl sandbox.
  2. Configuration: questions, denial direction, timeouts and the complete decision-model API contract with formatted examples.
  3. Payload limits: byte gates, sizing rationale and upstream context-limit errors.
  4. Logging: events, correlation and troubleshooting.
  5. Testing: local transport tests and manual validation.
  6. Context review: authenticated lookup, whole-record budgeting, omission indicators and HTTP-only fallback.
  7. Lab testing: deterministic sandbox checks with the simulated model, route/policy controls and real-model smoke examples.
  8. Present a demo: four synthetic requests with Jev scores and actual forwarding evidence, including separate Linux and Apple Silicon macOS instructions.

From this directory, with Rust 1.95.0 available:

cargo build --locked --release

Both the endpoint and model ID must be configured explicitly. The compatible model API and its expected response are described in configuration. No model or model weights are included.

export NOMOS_MODEL_ENDPOINT='https://decision.example.com/v1/systemone'
export NOMOS_MODEL_ID='example-model'
# Set NOMOS_MODEL_TOKEN securely if the endpoint requires a bearer credential.
cargo run --locked --bin nomos-request-review

The endpoint and model above are placeholders; replace them with your own compatible service. The default gRPC listener is 127.0.0.1:50051.

Dependencies and protocol compatibility

Builds download additional third-party open-source software. Review its terms before use; the complete Cargo.lock inventory is in THIRD_PARTY_NOTICES.md. The optional Python test destination has separate locked dependencies and is used only for integration validation. Benchmark datasets, runners and reports are not included. The integration lab helpers use only Python's standard library and do not require model credentials for simulated checks.

Bindings are generated from the copied Apache-2.0 OpenShell protocol files at the documented public revision. Use a compatible OpenShell build and check protocol negotiation before sending traffic. This integration does not promise compatibility with every OpenShell release.