Skip to content

fix: check connections to discovered backends #339

Closed

Description

@uniqueg

Problem

Before each request to a TES instance discovered in a service registry, proTES checks its host with foca.utils.http.check_public_host() (resolve, then check the addresses). The request itself goes through requests (py-tes), which resolves the host again. A host whose addresses change between the check and the request (DNS rebinding, TTL 0) passes the check and then connects to an internal address (e.g., 10.0.0.5 or 169.254.169.254), with proTES' access token for discovered TES instances with auth: client_credentials.

This gap is not new: proTES's own discovery (until #332) had it too, and docs/configuration.md names it ("The host check doesn't protect against DNS rebinding"). FOCA 0.18 has a fix: foca.utils.http.GuardedClient checks the address of each connection itself. FOCA's docs recommend check_public_host() for URLs before they are stored, and the guarded client for requests.

Proposal

Send requests to discovered TES instances through FOCA's guarded HTTP client (or its adapter mounted on the session that TesClient uses), so that the address of each connection is checked. Keep the per-request check_public_host() only if it is still needed. This fits #333, where TesClient sends the forward phase's OutboundRequests. Then remove the DNS rebinding caveat from the docs.

Found in the adversarial review of #332.

Acceptance criteria

  • Connections to discovered TES instances are checked per connection (private addresses refused unless allow_private_addresses), with tests.
  • Docs no longer name DNS rebinding as a gap.

Activity

  1. added
    priority: medium
    status: triage
    type: security
    workload: hours
    status: in progress
    and removed
    status: triage
    on Oct 29, 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

    priority: mediumstatus: in progresstype: securityworkload: hours

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions