Skip to content

Allow a wildcard/prefix in path_template for path-placed credentials (e.g. Telegram Bot API) #5544

Open

Description

@Qmrane

User Story

I use OpenShell to run several agent and automation sandboxes on a single host, some of which talk to the Telegram Bot API through provider-injected credentials.
I directly encountered this when moving the gateway to 0.1.8: a provider profile with path_template: /bot{credential}/ that worked before is now rejected by the 0.1.8 supervisor with 403 credential_placement_mismatch.
This affects any sandbox whose client library calls more than one method under the same credential-bearing path prefix.

Problem Statement

Since 0.1.8 the supervisor only accepts a path-placed credential when the request path matches the profile's path_template exactly: one template per credential, no wildcard. APIs that put the token in a path prefix and expose many methods below it (the Telegram Bot API: https://api.telegram.org/bot<TOKEN>/<method>, with sendMessage, getUpdates, editMessageText, sendPhoto, answerCallbackQuery, deleteMessage, ...) cannot be expressed with a single credential unless the client uses exactly one method.

This seems related to the change merged in #4886 ("fix(providers): harden static credential placement"). I could not find an existing issue asking for wildcard support.

Impact / Why This Matters

Without this feature, users must either:

  • pin the supervisor and sandbox runtime images to 0.1.7 (OPENSHELL_SUPERVISOR_IMAGE / OPENSHELL_SANDBOX_RUNTIME_IMAGE), because older supervisors keep the previous behavior. This is global to the gateway, so it blocks upgrading the supervisor for every sandbox; or
  • write a full template such as /bot{credential}/sendMessage and create one credential per method, which a third-party bot library that calls many methods cannot do without code changes.

Observed: every request from an affected sandbox fails with 403 credential_placement_mismatch (Telegram traffic was fully cut for the affected sandboxes until the pin was applied). Header-placed (Authorization) and query-placed credentials are not affected.

Proposed Design

A provider profile can declare a path-placed credential with a trailing wildcard/prefix, still anchored so the credential can only sit in the intended segment, for example:

path_template: /bot{credential}/*    # or /bot{credential}/**

Alternatively, a credential could accept several path_template entries. Either way, a request to /bot<real-token>/sendMessage, /bot<real-token>/getUpdates, etc. is accepted, and a request that puts the placeholder anywhere else is still rejected.

Acceptance Criteria

  • A profile can express "credential in this path prefix, any method below it" without one credential per method
  • The credential is still only substituted in the declared segment; a placeholder elsewhere in the path is rejected
  • Behavior for existing exact-match templates is unchanged
  • The Telegram Bot API works with a single credential and a library that calls several methods, on a current supervisor (no image pinning needed)

Alternatives Considered

  • Exact templates only (current behavior): works for single-method clients, not for libraries that call many methods.
  • One credential per method with a helper that picks the URL: requires changing application code and is not possible for third-party libraries.
  • Pinning the supervisor to 0.1.7 (current workaround): global to the gateway and blocks future supervisor upgrades.
  • Header or query placement: not available, the Telegram Bot API requires the token in the path.

Agent Investigation

No response

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:acceptedA maintainer decided OpenShell should pursue this issue
    and removed
    state:triage-neededOpened without agent diagnostics and needs triage
    on Nov 15, 2026
  2. added
    area:runtimeSandbox execution, isolation, supervision, policy enforcement, networking, and provider lifecycle.
    topic:authnzAuthentication, authorization, identity, sessions, credential protection, and policy integrity.
    on Nov 15, 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

    area:runtimeSandbox execution, isolation, supervision, policy enforcement, networking, and provider lifecycle.state:acceptedA maintainer decided OpenShell should pursue this issuetopic:authnzAuthentication, authorization, identity, sessions, credential protection, and policy integrity.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions