M
M
monochromer2018-12-24 10:35:38
System administration
monochromer, 2018-12-24 10:35:38

How can Node.js protect process.env from being read by 3rd party npm packages?

Very often, all sorts of settings, such as connecting to databases, are passed as environment variables. But any third party script can read process.env . How to protect yourself from this?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrey, 2018-12-25
@VladimirAndreev

Run the application under it by the created user, making the config file available only to this user.

O
ofigenn, 2018-12-25
@ofigenn

At the beginning of index.js (before the first require) copy process.env and replace it with an empty object)

A
Alexey Stupenkov, 2018-12-26
@alexstup

Don't pass data through environment

I
index0h, 2018-12-29
@index0h

To the fullest - none

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question