Handle secrets like API keys securely in javascript projects with environment variables

  Рет қаралды 2,209

GitGuardian

GitGuardian

9 ай бұрын

In this video we look at how to effectively use the dotenv npm package to securely use secrets like API keys by loading them into your project as environment variables. To do this we first place our secrets in a .env file and the dotenv project will load these in as env variables.
You can find a copy of the code used in this video in my public GitHub repository - github.com/mackenziejj/node-e...

Пікірлер: 11
@mk72v2oq
@mk72v2oq 8 ай бұрын
Worth mentioning that Node.js recently (20.6) introduced native support for .env files. So if your application supposed to run on new versions, you can drop dotenv dependency.
@dotenvx
@dotenvx 8 ай бұрын
there's some caveats - no multiline support, no override support, no expansion support, and no .env.vault support. We wrote about it on our blog.
@Ameer_Ameen
@Ameer_Ameen 8 ай бұрын
perfect video, thank you so much!
@ecstasy3129
@ecstasy3129 6 ай бұрын
Good
@richardnpaul_mob
@richardnpaul_mob 8 ай бұрын
ps -e reveals those secrets so env vars are not the best idea either (better than hard coding but there are better ways yet than env vars)
@GitGuardian
@GitGuardian 8 ай бұрын
We agree but this really gets into a deep conversation about the architecture behind your application and what is infrastructure it is running on. Envrionment variables won't be exposed unless one or more applications are already compromised so while it is not the most secure way, it is a good starting point in understanding how to handle secrets.
@richardnpaul_mob
@richardnpaul_mob 8 ай бұрын
@@GitGuardian that's fair though it's always good to know that there are downsides and potentially better approaches even if you're showing the most balanced approach in terms of trade-offs between effort to implement and deploy versus amount of improvement it gives 👍😊
@GitGuardian
@GitGuardian 8 ай бұрын
@@richardnpaul_mob Good points, next videos on my planned list are using secrets managers and vaults for secrets. We appreciate you giving us feedback 👍
@richardnpaul_mob
@richardnpaul_mob 8 ай бұрын
@@GitGuardian I'd better subscribe then 😊
@mk72v2oq
@mk72v2oq 8 ай бұрын
If your production environment is compromised, you are screwed. It doesn't really matter if env variables are visible, because malicious actor can simply directly read .env file (or whatever place you store secrets in) anyway.
Store & manage secrets like API keys in Python - Tech Tip Tuesdays
12:46
5 JavaScript API Key Mistakes (and how to fix them)
12:49
James Q Quick
Рет қаралды 75 М.
Опасность фирменной зарядки Apple
00:57
SuperCrastan
Рет қаралды 11 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 16 МЛН
Hacker101 - JavaScript for Hackers (Created by @STOKfredrik)
24:17
Your API Keys are NOT SAFE in a native app 🤬
9:26
Simon Grimm
Рет қаралды 10 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 559 М.
When RESTful architecture isn't enough...
21:02
Dreams of Code
Рет қаралды 263 М.
API Key Authentication Best Practices
25:56
Zuplo API Management
Рет қаралды 27 М.
Частая ошибка геймеров? 😐 Dareu A710X
1:00
Вэйми
Рет қаралды 4,3 МЛН
Looks very comfortable. #leddisplay #ledscreen #ledwall #eagerled
0:19
LED Screen Factory-EagerLED
Рет қаралды 9 МЛН
Look, this is the 97th generation of the phone?
0:13
Edcers
Рет қаралды 7 МЛН
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 482 М.
Samsung laughing on iPhone #techbyakram
0:12
Tech by Akram
Рет қаралды 6 МЛН
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 10 МЛН