Repository navigation
security: check the inference request path with the API path rules - #103
Merged
Merged
Conversation
…LOUD-2523] `InferenceClient._build_url` checked `path` only for `.` and `..` segments. A path built from untrusted input could add query parameters or a fragment to a request that carries the inference key. The forms `..;/` and `..%252f` also passed the check. The checks of `HTTPClient._add_base_url` are now in `verda.helpers.check_request_path`. Both clients call it. The function rejects `?`, `#`, `.` and `..` segments, and characters outside an allowlist. `HTTPClient` uses the same allowlist as before. `InferenceClient` also allows `:`, because TensorFlow Serving uses it (`my_model:predict`). `run_sync` and `run` on `InferenceClient` and `Deployment` now take a `params` argument, so that all inference calls can send query parameters. **Breaking changes:** - `InferenceClient` rejects a query string or fragment in `path`. Use `params`. - `InferenceClient` rejects characters in `path` other than letters, digits, `-._~`, `/` and `:`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yutkin
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
InferenceClient._build_urlcheckedpathonly for.and..segments. A path built from untrusted input could add query parameters or a fragment to a request that carries the inference key. The forms..;/and..%252falso passed the check.The checks of
HTTPClient._add_base_urlare now inverda.helpers.check_request_path. Both clients call it. The function rejects?,#,.and..segments, and characters outside an allowlist.HTTPClientuses the same allowlist as before.InferenceClientalso allows:, because TensorFlow Serving uses it (my_model:predict).run_syncandrunonInferenceClientandDeploymentnow take aparamsargument, so that all inference calls can send query parameters.Breaking changes:
InferenceClientrejects a query string or fragment inpath. Useparams.InferenceClientrejects characters inpathother than letters, digits,-._~,/and:.