Summary
The API key is exposed in plaintext to the frontend, allowing non-administrator users to view and reuse it. This can lead to unauthorized access to third-party services, potentially consuming limited quotas.
Details
Currently, the endpoint /console/api/workspaces/current/model-providers returns detailed information about custom model configurations, including credentials. A typical response looks like:
{
"data": [
{
"provider": "langgenius/openai_api_compatible/openai_api_compatible",
...
"custom_configuration": {
"custom_models": [
{
"model": "...",
"credentials": {
"api_key": "<plaintext_api_key>"
}
}
]
}
}
]
}
The API key can be found at:
custom_configuration.custom_models[0].credentials.api_key
PoC
- On Dify 1.10.1-fix.1, install the plugin OpenAI-API-Compatible (v0.0.25).
- Configure the plugin and add an LLM with an API key.
- Open the Plugins page and inspect Network requests in Developer Tools.
- Locate the request to
/console/api/workspaces/current/model-providers.
- In the response, find the entry with
provider: langgenius/openai_api_compatible/openai_api_compatible and extract the plaintext API key from custom_configuration.custom_models[0].credentials.api_key.
Impact
API keys are typically managed by administrators. Exposing them allows attackers to:
- Use these keys without authorization.
- Consume the administrator’s quota on third-party services.
- Potentially incur additional costs or service disruptions.
Summary
The API key is exposed in plaintext to the frontend, allowing non-administrator users to view and reuse it. This can lead to unauthorized access to third-party services, potentially consuming limited quotas.
Details
Currently, the endpoint /console/api/workspaces/current/model-providers returns detailed information about custom model configurations, including credentials. A typical response looks like:
{ "data": [ { "provider": "langgenius/openai_api_compatible/openai_api_compatible", ... "custom_configuration": { "custom_models": [ { "model": "...", "credentials": { "api_key": "<plaintext_api_key>" } } ] } } ] }The API key can be found at:
custom_configuration.custom_models[0].credentials.api_keyPoC
/console/api/workspaces/current/model-providers.provider: langgenius/openai_api_compatible/openai_api_compatibleand extract the plaintext API key fromcustom_configuration.custom_models[0].credentials.api_key.Impact
API keys are typically managed by administrators. Exposing them allows attackers to: