Unify secure-gateway URL wrappers: inference_models proxy builder lacks idempotence guard and drops gateway base path

Open
#2,662 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@adhavan18 is already working on this.

Since Aug 15, 2026.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
api, backend, security

Research direction

Start with roboflow_secure_gateway_proxy_url_builder in inference_models/inference_models/weights_providers/roboflow.py and compare it with wrap_url in inference/core/utils/url_utils.py. Then inspect inference_sdk's InferenceHTTPClient and the StepExecutionMode consumption point. Done means wrapped URLs remain idempotent and preserve gateway base paths, while REMOTE execution cannot bypass the gateway, with shared behavior or cross-package tests.

Written by the indexing model from the issue text.

Description

Follow-ups from the secure-gateway audit on #2658 (out of that PR's scope):

1. roboflow_secure_gateway_proxy_url_builder (inference_models/inference_models/weights_providers/roboflow.py) diverges from wrap_url (inference/core/utils/url_utils.py):

  • No idempotence guard: an already-wrapped download_url gets double-proxied ({gateway}/proxy?url={gateway}%2Fproxy%3Furl%3D...). wrap_url gained this guard in #2658.
  • Base-path handling differs: the builder uses urlsplit scheme+netloc only, dropping any path on the gateway value (SECURE_GATEWAY=https://gw.local/edge → weights traffic goes to gw.local/proxy while server traffic goes to gw.local/edge/proxy).

Both wrappers implement the same /proxy?url= contract; they should either share one implementation or be kept behavior-identical with cross-package tests.

2. Per-run step_execution_mode bypasses the env-level hosted-endpoint gate: #2658 forces WORKFLOWS_STEP_EXECUTION_MODE=local behind SECURE_GATEWAY when the hosted target is configured, but a caller passing workflows_core.step_execution_mode=StepExecutionMode.REMOTE via init_parameters still routes all 42 run_remotely blocks at HOSTED_*_URL — unreachable behind a gateway. The durable fix is gateway support in inference_sdk's InferenceHTTPClient (it path-joins onto api_url, which cannot compose with /proxy?url=<encoded>), or a guard at the StepExecutionMode consumption point.

Context: #2658, #2263.

Dominant language
Python
Stars
2.5k
Forks
340
Avg merge
2d 11h
Merged PRs (30d)
92

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from roboflow/inference

All issues in roboflow/inference

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.