Problem when using a library that uses debug
in Deno #981
Open
Description
I use jsdom
in a project in Deno. jsdom
uses debug
as a dependency:
└─┬ [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected]
└─┬ [email protected]
└── [email protected] deduped
Deno asks for permission for access to environment variables. Unfortunately debug
accesses process.env
directly and on requiring the module itself which leads to the following request by Deno.
┏ ⚠️ Deno requests env access.
┃ ├─ Object.toObject (ext:runtime/30_os.js:134:12)
┃ ├─ Object.ownKeys (ext:deno_node/_process/process.ts:54:40)
┃ ├─ Function.keys (<anonymous>)
┃ ├─ Object.<anonymous> (file:///home/krlwlfrt/work/krlwlfrt/calendar/node_modules/debug/src/node.js:124:30)
┃ ├─ Object.<anonymous> (file:///home/krlwlfrt/work/krlwlfrt/calendar/node_modules/debug/src/node.js:267:4)
┃ ├─ Module._compile (node:module:745:34)
┃ ├─ loadMaybeCjs (node:module:770:10)
┃ ├─ Object.Module._extensions..js (node:module:755:12)
┃ ├─ Module.load (node:module:662:32)
┃ └─ Function.Module._load (node:module:534:12)
┠─ Learn more at: https://docs.deno.com/go/--allow-env
┠─ Run again with --allow-env to bypass this prompt.
┗ Allow? [y/n/A] (y = yes, allow; n = no, deny; A = allow all env permissions) >
This goes against the principle of least privilege. Denying the request leads to an exception, because the code can't handle a rejection of that request with Deno's API.
Long story short: Could you please change the behaviour of your library, so that the process.env
is not accessed on module load?
Metadata
Assignees
Labels
No labels