Repository navigation
fix(openapi): leave a model's api key and endpoint out of the model lists - #1514
Merged
Merged
Conversation
…ists
GET /llm-configs and GET /llm-provider/{provider}/models returned the LlmModelSetting objects as bound from
LlmProviders, ApiKey and Endpoint included, so any signed-in user could read every model's key. The settings page
(/setting/LlmProviders) already masks both through LlmProviderPlugin.MaskSettings; these two lists did not.
- LlmModelSetting.WithoutCredentials / LlmProviderSetting.WithoutCredentials: a copy with ApiKey empty and Endpoint
null; everything else (capabilities, reasoning, image, cost...) is kept.
- LlmProviderController returns those copies. The settings the providers call the models with are not touched.
Tests:
- LlmProviderControllerTests: neither list carries the key or the endpoint, in the objects or the serialized JSON,
and the service's own instances keep both; both tests fail without the change.
- BotSharp.Core.UnitTests: 565 passed, 1 failed (SharpCacheAgentMemoryTests.GetAgent_caches_per_scope_without_adding_shared_cache_entries,
which fails the same way on master without this change).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Member
|
reviewed |
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.
Problem
GET /llm-configsandGET /llm-provider/{provider}/modelsreturn theLlmModelSettingobjects bound fromLlmProvidersas they are, soApiKeyandEndpointgo out in the response. Both actions only require a signed-in user ([Authorize]), so any user can read the api key of every configured model.The settings page (
GET /setting/LlmProviders) already masks both fields throughLlmProviderPlugin.MaskSettings; these two lists did not.Change
LlmModelSetting.WithoutCredentials()returns a copy withApiKeyempty andEndpointnull. Everything else is kept (type, capabilities, reasoning, image, audio, cost...), so clients that pick a model from these lists see the same data as before.LlmProviderSetting.WithoutCredentials()does the same for every model of a provider.LlmProviderControllerreturns these copies from both actions. They are copies, so the settings the providers call the models with keep their key and endpoint, even ifILlmProviderServicehands out shared instances.The BotSharp UI reads these two endpoints only to list providers and models; it does not use
api_keyorendpoint.Testing
LlmProviderControllerTests:BotSharp.Core.UnitTests: 565 passed, 1 failed. The failure isSharpCacheAgentMemoryTests.GetAgent_caches_per_scope_without_adding_shared_cache_entries, which fails the same way onmasterwithout this change.🤖 Generated with Claude Code