Nuxt · NUXT0054

Do not expose secrets in runtimeConfig.public

Flags secret in public config in Nuxt runtime code before it leaks into runtime behavior.
NUXT0054vite-doctor/nuxtruntime-configerrorSuggestion

Run this rule

pnpm nuxt doctor --rules nuxt/runtime/no-secret-in-public-config

Why it matters

Secrets that reach public runtime config or client bundles can be exposed to every visitor and crawler. Keys that are public by design, such as publishable, site, widget, project, or bare key values, are not reported; generic apiKey names are reported as a low-confidence warning because browser keys like Firebase or Algolia search keys belong in public config.

Move secrets to private runtimeConfig and read them only on the server.

Example

Avoid secret in public config

Before

export default defineNuxtConfig({
  runtimeConfig: {
    public: { apiSecret: process.env.API_SECRET },
  },
})

After

export default defineNuxtConfig({
  runtimeConfig: {
    apiSecret: process.env.API_SECRET,
    public: { apiBase: '/api' },
  },
})
Copyright © 2026