Skip to content

fix: scope the models list to the caller's organization - #364

Merged
Priyanshu-u07 merged 1 commit into
mainfrom
models-scope-to-org
Sep 25, 2026
Merged

Priyanshu-u07 merged 1 commit into
mainfrom
models-scope-to-org

Conversation

@Priyanshu-u07

Copy link
Copy Markdown
Collaborator

list_models authenticated the API key and then queried deployments with no organisation filter, so any valid key listed every org's running deployments. The cache key above it was already org-aware; the query it cached was not.

Adds the org filter. Two things the issue notes go with it: other orgs' endpoints are no longer health-checked on every call, and pagination now counts only the caller's rows.

Worth calling out for review: the health-check loop decrypts each deployment's own credentials to probe it, so before this fix one tenant's model list made the gateway fire authenticated requests at every other tenant's inference endpoint, ten at a time.

Also returns an empty list when the key has no organisation. Not in the issue, but without it the query becomes org_id IS NULL and hands back every orgless deployment; the management endpoint already behaves this way.

Tests assert on the compiled SQL, since a mocked session returns whatever it's given regardless of the WHERE.

Closes #341

Signed-off-by: Priyanshu-u07 <connect.priyanshu8271@gmail.com>
@Priyanshu-u07
Priyanshu-u07 merged commit 6782df4 into main Sep 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GET /v1/models returns every organisation's deployments

1 participant