Skip to content

docs(examples): add a runnable ANS identity example for supervisor middleware #5011

Open

Description

@kperry-godaddy

User Story

I run OpenShell v0.1.7 (gateway, sandbox supervisor and sandboxes on the Docker driver) to evaluate an external supervisor middleware that attaches an operator-assigned, verifiable agent identity to outbound HTTP requests while keeping the signing key outside the sandbox. The middleware is the ANS identity extension and we maintain it. I need a reproducible example that exercises the real gateway and supervisor and shows the receiving service verifying that identity, and I need it to be discoverable from the supervisor middleware documentation so other middleware authors can start from it.

Problem Statement

OpenShell supports external supervisor middleware and documents a content-guard example. It does not provide a runnable request-identity example showing how an external middleware service attaches a verifiable agent identity outside the sandbox and how a receiving service validates it.

This is a documentation and example contribution using the existing middleware contract. Its scope is HTTP request signing and verification against OpenShell v0.1.7.

Impact / Why This Matters

An extension author evaluating this workflow has to assemble gateway authentication, middleware registration with explicit bindings, sandbox policy, sandbox-to-identity authorization, and a verifying endpoint independently. An in-process middleware test does not establish that the real gateway and supervisor invoke the service, apply its header mutations, or block traffic when the middleware fails.

The example gives users a reproducible way to validate those boundaries while keeping signing keys outside the workload, and gives the external middleware contract a concrete interoperability check that runs against a released OpenShell version.

Proposed Design

Add a small supervisor middleware example and link it from the supervisor middleware documentation. The example uses the existing ANS identity extension, maintained in its own repository and referenced at an immutable release tag.

The user workflow:

  1. On Linux or macOS (Apple silicon) with Docker and the documented prerequisites, run one documented command.
  2. The launcher fetches the extension at the pinned tag, downloads the pinned OpenShell v0.1.7 CLI and gateway release assets and verifies their checksums, mints disposable identity and trust fixtures, starts the extension and a reference verifying endpoint, and starts an authenticated gateway with the middleware registered.
  3. It creates a sandbox with the middleware attached, authorizes the gateway-issued sandbox ID for one identity through operator-controlled configuration, and sends ordinary HTTP requests from the sandbox.
  4. It asserts the identity guarantees listed under Acceptance Criteria, then removes its sandboxes, processes and temporary material.

Gateway authentication stays enabled and the extension is called over TLS with gateway-issued JWTs. The example uses generated, explicitly trusted test artifacts and needs no production credentials and no live registration service; the documentation separates that fixture trust from production registration. It requires no OpenShell runtime changes.

Notional configuration

Within the example's complete gateway configuration:

[[openshell.supervisor.middleware]]
name = "ans-identity-example"
grpc_endpoint = "https://<reachable-middleware-host>:50051"
tls_ca_cert_path = "/path/to/example-ca.pem"
max_payload_bytes = 1048576
timeout = "2s"
binding_policy = "allowlist"
bindings = ["http_request_pre_credentials"]

Within the example's complete sandbox policy:

network_middlewares:
  ans-identity:
    middleware: ans-identity-example
    order: 100
    on_error: fail_closed
    endpoints:
      include: ["host.openshell.internal"]
    config:
      mode: sign
      identity: example-agent

The runnable example supplies the authenticated gateway configuration, reachable local addresses, certificates, network policy, trust roots and sandbox identity approval. Signing is placed last in the request middleware chain.

Acceptance Criteria

The harness that implements this workflow is merged in the extension repository (examples/openshell-smoke at v0.1.1) and runs on every push to its main branch on ubuntu-latest (latest run). It also passes on macOS (Apple silicon) with Rancher Desktop and with Docker Desktop. Items checked below are what those runs assert against OpenShell v0.1.7.

  • A documented command runs the example from a clean checkout on the supported Linux/Docker environment with pinned component revisions and no production secrets.
  • An authorized sandbox's request is verified by the receiving service, which returns the exact expected ANS identity.
  • Workload-supplied forged identity headers are replaced, and the receiver verifies the operator-assigned identity.
  • A sandbox without an approved identity binding cannot cause the protected operation to execute (403 middleware_denied, and the receiving service's log does not grow).
  • An unavailable middleware service blocks the affected request, and the protected operation is not executed (403 middleware_failed under on_error: fail_closed).
  • The receiving service rejects an unsigned direct request (401).
  • The example reports assertion failures, cleans up its resources, and distinguishes actual OpenShell runtime checks from separate verifier replay/tampering tests.
  • Documentation explains the trust boundary, fixture versus production trust, supported versions, maintainer ownership, and limitations, and is linked from the supervisor middleware documentation. The extension's documentation covers the first part; the link from OpenShell's supervisor middleware documentation is what the proposed pull request adds.

Alternatives Considered

  • Existing content-guard example: demonstrates the middleware lifecycle and content transformations. This example adds request signing, per-sandbox identity authorization, and verification by the receiving service.
  • Existing in-process ANS demo: checks signing, verification, replay, tampering, and caller authorization, but simulates the supervisor. It remains useful alongside the real-runtime check.
  • Provider credential injection and SPIFFE token-grant examples: useful existing identity and credential workflows. This proposal demonstrates an external request-signing extension with a named agent identity and a receiving verifier.
  • Gateway interceptor: suited to governing control-plane operations; this use case acts on allowed outbound HTTP requests, so supervisor middleware is the applicable extension point.
  • Built-in implementation: unnecessary; the external extension contract already supplies the required integration boundary, and the example needs no runtime changes.

Compatibility Investigation

  • The example runs against OpenShell v0.1.7 (released November 3, 2026): the CLI and gateway release assets are pinned by SHA-256 and the supervisor and sandbox runtime images by manifest digest. Gateway authentication is enabled, and the middleware is registered with binding_policy = "allowlist" and bindings = ["http_request_pre_credentials"], so a service that stops advertising the request hook is refused rather than skipped.
  • The extension's vendored extension.proto, supervisor_middleware.proto, and gateway_interceptor.proto are checked against the pinned OpenShell commit in the extension's CI, so the published contract and the vendored copy cannot drift silently.
  • Observed on v0.1.7: after the middleware restarts to apply a new sandbox identity approval, the supervisor's channel to it reconnects within a few seconds, and matching requests fail closed with middleware_failed until it does. The example retries through that window and documents it as a limitation.
  • The example's harness shares a Docker daemon with other gateways safely: it runs under its own sandbox_label, so the gateway's startup reconciliation does not touch another gateway's supervisor containers.

References: v0.1.7 release, middleware configuration, content-guard example, extension harness README.

Checklist

  • I've reviewed existing issues and the published docs.
  • This is a design proposal with a bounded contribution scope.

Activity

  1. added
    state:triage-needed
    on Oct 28, 2026
  2. changed the title [-]docs(examples): add a runnable ANS identity example for supervisor middleware[/-] [+][Draft proposal] docs(examples): add a runnable ANS identity example for supervisor middleware[/+] on Oct 28, 2026
  3. changed the title [-][Draft proposal] docs(examples): add a runnable ANS identity example for supervisor middleware[/-] [+]docs(examples): add a runnable ANS identity example for supervisor middleware[/+] on Nov 7, 2026
  4. kperry-godaddy commented on Nov 11, 2026

    @kperry-godaddy
    Author

    Chris White asked that a demo be included. Here is the example running end to end, recorded on macOS with Docker against OpenShell v0.1.7:

    The ANS identity example passing its five checks against OpenShell v0.1.7

    What the recording shows, in order:

    1. Authorized sandbox. A plain POST from the sandbox reaches the receiving service signed: a DPoP proof, the agent's transparency-log receipt and its status token, all added by the supervisor middleware. The service verifies them and returns the operator-assigned ANS identity.
    2. Forged identity headers. DPoP, X-SCITT-Receipt and X-ANS-Status-Token set inside the sandbox are overwritten, not relayed. The service still sees only the assigned identity.
    3. Unsigned direct request. A request that bypasses OpenShell carries no proof and is rejected with 401. This also proves the service logs rejections, which the next two checks rely on.
    4. Unapproved sandbox. A second sandbox whose gateway-issued id is not in the middleware's approval list gets 403 middleware_denied with reason ans_identity_unauthorized. The service's log does not grow, so it never saw the request.
    5. Middleware unavailable. With the middleware stopped, the request gets 403 middleware_failed under on_error: fail_closed, and again the service is not reached.

    No OpenShell runtime changes are involved; the middleware uses the documented PRE_CREDENTIALS request hook. Every key in the run is minted for that run and discarded. The in-process demo in the extension repository (make demo) covers replay and body tampering at the verifier; this example covers what only a real runtime can show.

    To run it from the staged branch:

    git clone -b docs/5011-ans-identity-example/kperry-godaddy https://github.com/kperry-godaddy/OpenShell
    cd OpenShell && ./examples/supervisor-middleware-ans-identity/smoke.sh

    The launcher clones the extension at its pinned release (v0.1.1) and runs its smoke test; the same test runs directly with make openshell-smoke from https://github.com/agentnameservice/ans-openshell at that tag. Prerequisites and the trust-boundary notes are in the example's README on that branch. Vouch request: #5368

  5. purp commented on Nov 20, 2026

    @purp
    Contributor

    📋 triage-agent

    Assessment: valid and well evidenced. This is a docs and example contribution on the documented supervisor middleware extension point and needs no runtime change. The user story is first-hand, the notional gateway and policy configuration is concrete, and the acceptance criteria are backed by the merged harness (agentnameservice/ans-openshell#21), its CI runs, and the recorded demo.

    Reviewed the staged branch (docs/5011-ans-identity-example/kperry-godaddy). It adds examples/supervisor-middleware-ans-identity/ and a two-line link in docs/extensibility/supervisor-middleware/index.mdx. Its smoke.sh clones the extension at tag v0.1.1 and runs that repository's smoke test.

    Questions for the author before a PR:

    1. Can the launcher pin the extension by commit SHA (keeping the tag for readability)? Git tags can be moved.
    2. The example pins OpenShell v0.1.7 and runs only in the extension's CI, while the middleware docs warn the contract will change. How would the pin follow OpenShell releases, and how should the example's README state the last OpenShell version it was verified against?

    Remaining decision: where the example lives, either an in-tree launcher under examples/ (as staged) or a link from the middleware docs to the extension repository. The vouch request (#5368) is also pending; it's required before a PR.

  6. added
    state:validated
    state:accepted
    area:runtime
    topic:authnz
    topic:documentation
    topic:extensions
    and removed
    state:triage-needed
    on Nov 20, 2026
  7. purp commented on Nov 20, 2026

    @purp
    Contributor

    Vouch request has been completed. Would love to see this PR, @kperry-godaddy. Add me as a reviewer when you put it up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:runtimestate:acceptedstate:validatedtopic:authnztopic:documentationtopic:extensions

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions