Skip to content

feat(network): per-endpoint opt-in to keep ";" path parameters on L7 REST endpoints #5962

Backlog

Description

@u0324020

User Story

I'm a senior engineer at VicOne, an automotive cybersecurity company. We run Hermes Agent inside OpenShell sandboxes on EKS as an internal assistant for Microsoft Teams. People talk to it in team channels, and it replies inside the channel thread, posts a notice when meeting notes are archived, and sends Adaptive Cards with action buttons. We use OpenShell so the agent can reach only the hosts it needs. Its outbound calls to the Bot Framework connector go through a protocol: rest endpoint.

After I moved the assistant into an OpenShell sandbox, its replies to channel threads stopped appearing in the thread. Each one showed up as a new top-level post in the channel instead. Nothing failed: Bot Framework accepted every request, and the proxy logged no deny. I traced it to the L7 proxy removing ;messageid=<root> from the conversation path before forwarding.

For our teams this broke threaded conversations with the assistant, and its Adaptive Card buttons stopped working because the cards landed in a different conversation.

Problem Statement

On a protocol: rest endpoint, the L7 proxy canonicalizes the request target, and with the default options it removes everything after ; in every path segment. The rewritten path is also the one forwarded upstream: when canonicalization changes the target, the request line is rebuilt with the canonical path before the request leaves the sandbox.

CanonicalizeOptions already has a switch for this (strip_path_parameters), and its doc comment says operators opt in to looser behaviour per endpoint. Unlike allow_encoded_slash, though, the switch is not exposed in policy YAML or provider profiles. An operator whose upstream API uses ; as data has no way to keep it on that endpoint.

The rewrite is also silent. The request is allowed, no deny or OCSF finding is emitted, and the published policy docs do not mention that path parameters are removed.

Impact / Why This Matters

Microsoft Bot Framework is one API where ; carries data. A reply into a Microsoft Teams channel thread can be sent as:

POST {serviceUrl}/v3/conversations/19:{channel}@thread.tacv2;messageid={rootMessageId}/activities

Microsoft's Python Teams SDK builds this ;messageid= conversation id (to_threaded_conversation_id in microsoft_teams/apps/utils/thread.py), and releases before 2.2.0 send thread replies this way. Behind an OpenShell REST endpoint, the proxy forwards /v3/conversations/19:{channel}@thread.tacv2/activities instead, which is the channel itself.

In our deployment at VicOne, Bot Framework accepted those requests and the replies appeared as new top-level channel posts. There was no error on either side. In one channel thread, all 35 of the bot's replies before it moved into a sandbox landed in the thread. After the move none did, and 37 bot posts appeared at the channel's top level over the same period. The supervisor's OCSF events recorded the forwarded path ending in @thread.tacv2/activities. Adaptive Cards that landed at the top level also broke the bot's card handling, because button clicks came back from a different conversation.

Current workarounds, and why they fall short:

Proposed Design

Add a per-endpoint boolean that keeps path parameters, next to allow_encoded_slash. The name below is only a placeholder.

bot_framework:
  endpoints:
    - host: smba.trafficmanager.net
      port: 443
      protocol: rest
      enforcement: enforce
      allow_path_parameters: true   # default false: ";params" are stripped as today
      rules:
        - allow:
            method: POST
            # the serviceUrl path has a prefix segment, such as /teams/
            path: /**/v3/conversations/*/activities
  binaries:
    - path: /usr/bin/python3

Behaviour when the option is on:

  • ; and the bytes after it stay in the segment, both in the path that policy rules match against and in the request line that is forwarded.
  • A segment whose part before the first ; is . or .. (for example ..;x) is still treated as a dot-segment, resolved or rejected exactly as today, so it cannot step past the traversal guard. This includes the residual dot-segment check for parts split by an encoded slash on endpoints that also set allow_encoded_slash.
  • Everything else about canonicalization (%2F handling, control-byte rejection, re-encoding) is unchanged.

Behaviour when the option is off (the default): unchanged.

This is an explicit trade-off, which is why it should only ever be per-endpoint. With the option on, a rule path is matched against the literal segment, so a deny rule such as /repos/private/** does not match /repos/private;x/foo. If the upstream server itself drops ;params, it would serve /repos/private/foo. The option is meant for APIs where ; is part of an identifier, and the docs for it should say so.

The same field should be settable from a provider profile, the way allow_encoded_slash is, so a profile for a given API can declare it once.

Separately, and optional for this issue: when canonicalization changes the forwarded target, record that somewhere an operator can see it (a log line or an OCSF field). That would have turned this from a silent misroute into a one-line diagnosis.

Acceptance Criteria

  • A REST endpoint in policy YAML (and in a provider profile) can set the new option. It defaults to off, and existing policies behave exactly as before.
  • With the option off, /v3/conversations/19:[email protected];messageid=123/activities is still forwarded as /v3/conversations/19:[email protected]/activities.
  • With the option on, both the path seen by policy evaluation and the forwarded request line keep ;messageid=123.
  • With the option on, /a/..;x/b, /a/.;x/b, their percent-encoded forms, and the same parts behind an encoded slash on allow_encoded_slash endpoints are still resolved or rejected as dot-segments. No path escapes the traversal guard.
  • The policy schema reference lists the option and its deny-rule trade-off, and the docs state that path parameters are stripped by default.
  • (Optional) A request whose target was changed by canonicalization is identifiable in logs or OCSF.

Alternatives Considered

  • Middleware, interceptors or providers. Canonicalization runs inside the HTTP request parser, before policy evaluation, and the forwarded request line is rebuilt there. We did not find an extension point that sees the original target. A provider profile is still the natural place to turn the new option on for Bot Framework hosts.
  • Policy on the canonical path, forward the original bytes. This brings back the parser differential that canonicalization exists to close. Not proposed.
  • Stop stripping by default. This weakens the ;jsessionid-style ACL defence on every endpoint. Not proposed.
  • Client-side changes only (/replyChains, %3B). Covered under Impact.

Agent Investigation

Code references are against main at 6dcd3a977.

  • crates/openshell-supervisor-network/src/l7/path.rs:60-84: CanonicalizeOptions defines allow_encoded_slash (default false) and strip_path_parameters (default true). The doc comment says operators opt in to looser behaviour per endpoint.
  • path.rs:181-191: parameters are stripped before dot-segment resolution, so that ..; cannot slip past the traversal guard. Any opt-out has to keep that property.
  • path.rs:199-205: the residual dot-segment check compares each part split by the encoded-slash sentinel to exactly . or ... With stripping off, a ..;x part would pass it, so this check needs the same treatment.
  • path.rs:337-341: build_canonical_path strips parameters a second time during reconstruction. Both sites read the same option.
  • path.rs:533-544: the existing test path_parameters_preserved_when_disabled covers the non-stripping branch, but not ..; with stripping off.
  • crates/openshell-supervisor-network/src/l7/rest.rs:317-333: the target is canonicalized before OPA evaluation, and when it was rewritten the request line is rebuilt with the canonical path before forwarding.
  • strip_path_parameters appears only in path.rs. allow_encoded_slash is wired through the policy schema, policy runtime, provider profiles and CLI (fix(sandbox): canonicalize HTTP request-targets before L7 policy evaluation #878, fix(sandbox): preserve encoded slash policy from proto #1073), which is the pattern to copy.
  • path.rs has no commits between v0.1.6 and main.
  • Related: bug(network): L7 path canonicalization treats percent-encoded %3B as a path-parameter delimiter and silently truncates the forwarded path #3902 (%3B is decoded, then stripped and truncated). It suggests strip_path_parameters: false as a workaround, but that setting is not exposed today.

Checklist

  • I've reviewed existing issues and the published docs
  • This is a design proposal, not a "please build this" request

Activity

  1. added
    state:triage-needed
    on Nov 25, 2026
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

    state:triage-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions