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

Closed
opened 2026-02-16 10:15:59 -05:00 by yindo · 1 comment
Owner

Originally created by @fujita-h on GitHub (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.

https://github.com/langgenius/webapp-conversation/blob/9d2d092e9e652c92bdf4234b18216b151ac2bd17/config/index.ts#L3

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

https://github.com/langgenius/webapp-conversation/blob/9d2d092e9e652c92bdf4234b18216b151ac2bd17/app/components/index.tsx#L22

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.

Originally created by @fujita-h on GitHub (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. https://github.com/langgenius/webapp-conversation/blob/9d2d092e9e652c92bdf4234b18216b151ac2bd17/config/index.ts#L3 In addition, this `API_KEY` is loaded in the client component. https://github.com/langgenius/webapp-conversation/blob/9d2d092e9e652c92bdf4234b18216b151ac2bd17/app/components/index.tsx#L22 This makes the `API_KEY` (=`APP_KEY`) public. ![Image](https://github.com/user-attachments/assets/527e933e-f664-40ad-8a8e-fdc6ed07dd7f) 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](https://nextjs.org/docs/14/pages/building-your-application/configuring/environment-variables#bundling-environment-variables-for-the-browser).
yindo closed this issue 2026-02-16 10:15:59 -05:00
Author
Owner

@zhaoxiaohai commented on GitHub (Feb 8, 2025):

I urgently need to solve this problem.

@zhaoxiaohai commented on GitHub (Feb 8, 2025): I urgently need to solve this problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/webapp-conversation#63