Executive brief
nuxt-ollama is a Nuxt module that integrates Ollama AI models into web applications. When configured with a cloud API key (as documented), the module incorrectly exposes this secret credential in the browser-readable HTML payload sent to all page visitors. An unauthenticated attacker can retrieve the API key with a single HTTP request and then make unauthorized API calls at the application operator's expense, leading to financial loss and service disruption.
Technical details
This is a credentials exposure vulnerability (CWE-522) caused by a design flaw in src/module.ts. During Nuxt module setup, the entire _options object (containing api_key when configured for cloud Ollama per README.md:71-80) is unconditionally merged into runtimeConfig.public.ollama. Nuxt's SSR pipeline serializes runtimeConfig.public into every server-rendered HTML page within a <script> block (window.__NUXT__) for client-side hydration. The browser-side composable then reads this leaked api_key and includes it as an Authorization: Bearer header in client-side Ollama API calls. Attack vector: network, no authentication required, no user interaction needed. An attacker performs a single unauthenticated HTTP GET request to the application's home page and extracts the plaintext api_key from the HTML response. The recommended fix moves api_key to the private (non-serialized) runtime config namespace and removes it from browser composables, ensuring it is only available server-side. Patched in version 1.3.1.
Affected products
- thoda-dev nuxt-ollama >=1.2.26, <1.3.1
Timeline
- 2026-06-20: disclosed
- 2026-09-09: advisory
- 2026-09-09: patched: Patched in version 1.3.1