Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The NEXT_PUBLIC_ prefix is ​​unnecessarily added to the environment variables, and the APP_KEY is in a public state. #132

Open
fujita-h opened this issue Jan 19, 2025 · 0 comments · May be fixed by #133

Comments

@fujita-h
Copy link

fujita-h commented Jan 19, 2025

Sumamry

Environment variables with NEXT_PUBLIC_ are expanded at build time, so they should not be assigned to credentials, etc.

Current Behavior

NEXT_PUBLIC_APP_KEY is stored in the variable below.

export const API_KEY = `${process.env.NEXT_PUBLIC_APP_KEY}`

In addition, this API_KEY is loaded in the client component.

import { API_KEY, APP_ID, APP_INFO, isShowPrompt, promptTemplate } from '@/config'

This makes the API_KEY (=APP_KEY) public.

Image

Depending on usage, API keys managed by Dify users may be leaked to third-party users.

Note

The Next.js documentation on this topic is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant