DEV Community

Discussion on: Adding configurations to your React App at Runtime

Collapse
 
ziker22 profile image
Zikitel22 • Edited

This solution can have bad security implications its straight dangerous recommending it in a blog post. This could be solved by using env vars

Collapse
 
hey_yogini profile image
Yogini Bende

Hey,
This particular solution can be very useful in certain use-cases and that was the only purpose of sharing it in a blog post. I may have missed the implementation of env vars in runtime and would love to understand how it is done. If you can share implementation details for that, it would be really enlightening :)

Collapse
 
ziker22 profile image
Zikitel22

freecodecamp.org/news/how-to-imple...

This is of course only one of the implementations, but the idea is there :)

Thread Thread
 
hey_yogini profile image
Yogini Bende

Thanks for sharing. Will surely check and try to implement. 🙌

Thread Thread
 
ofirkg profile image
Ofir Katz

@ziker22
the link you provided literally has the same solution described here, maybe you misunderstood the concept of runtime config?

Collapse
 
fires3as0n profile image
fires3as0n • Edited

There are no security implications in this approach. Env vars will not solve anything in this case. This is a Frontend application, every line of code including config variables it has is available to any user on the internet.

It is a common error to mess BE (where config is sensible) and FE (where it is not) security approaches.