coreui / coreui-free-react-admin-template

Open source admin template based on Bootstrap 5 and React.js
https://coreui.io/product/free-react-admin-template/
MIT License
4.54k stars 2.26k forks source link

Security Problem With Process Env #423

Closed PedroGSantos closed 4 months ago

PedroGSantos commented 4 months ago

I have a problem using the current code using process.env in the config file of vite. Actually, the process.env from Node.JS invokes all enviroment variables from the SO. Consequently, when we build the application, we can see all enviroment variables by searching in the developer tools of the browser.

Here's an example

Especially in a CI/CD flow, this is a crucial problem because a host that runs a CI/CD flow can have password env variables in the SO.

To solve this, I just created a .env file and use this guidelines provided by VITE to create env variable: https://vitejs.dev/guide/env-and-mode#env-files

This guidelines specify that we need to create a env with the prefix VITE and references like this console.log(import.meta.env.VITE_SOME_KEY)

Enviroment:

PedroGSantos commented 4 months ago

Do I need to create a issue for this PR?

@mrholek