Skip to content

permission: add --allow-env flag for environment variable access control#62827

Open
nabeel378 wants to merge 5 commits intonodejs:mainfrom
nabeel378:feat/permission-allow-env-flag
Open

permission: add --allow-env flag for environment variable access control#62827
nabeel378 wants to merge 5 commits intonodejs:mainfrom
nabeel378:feat/permission-allow-env-flag

Conversation

@nabeel378
Copy link
Copy Markdown
Contributor

Adds --allow-env permission flag to control access to environment
variables when the permission model is enabled (--permission).

Supported usage:

  • --allow-env — grants access to all environment variables
  • --allow-env=HOME,PATH — grants access only to specified variables

When --permission is enabled without --allow-env, all calls to
process.env will throw ERR_ACCESS_DENIED.

Fixes: #62424

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config
  • @nodejs/gyp
  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Apr 19, 2026
@nabeel378 nabeel378 marked this pull request as draft April 19, 2026 10:23
@nabeel378 nabeel378 force-pushed the feat/permission-allow-env-flag branch from 9c74582 to f3544f8 Compare April 19, 2026 11:26
Signed-off-by: nabeel378 <mohammadnabeeljameel@gmail.com>
@nabeel378 nabeel378 marked this pull request as ready for review April 19, 2026 12:59
…r environment variables

Signed-off-by: nabeel378 <mohammadnabeeljameel@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 19, 2026

Codecov Report

❌ Patch coverage is 89.06250% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.55%. Comparing base (58a8e1d) to head (b6a89cf).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/node_env_var.cc 87.09% 0 Missing and 4 partials ⚠️
src/permission/env_var_permission.cc 85.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62827      +/-   ##
==========================================
- Coverage   89.69%   89.55%   -0.14%     
==========================================
  Files         706      708       +2     
  Lines      218222   218931     +709     
  Branches    41768    41881     +113     
==========================================
+ Hits       195731   196065     +334     
- Misses      14411    14745     +334     
- Partials     8080     8121      +41     
Files with missing lines Coverage Δ
lib/internal/process/permission.js 83.87% <100.00%> (-16.13%) ⬇️
src/env.cc 85.12% <100.00%> (-0.34%) ⬇️
src/node_options.cc 76.53% <100.00%> (+0.02%) ⬆️
src/node_options.h 97.98% <ø> (ø)
src/permission/env_var_permission.h 100.00% <100.00%> (ø)
src/permission/permission.cc 81.92% <100.00%> (+0.33%) ⬆️
src/permission/permission.h 100.00% <ø> (ø)
src/permission/env_var_permission.cc 85.00% <85.00%> (ø)
src/node_env_var.cc 82.08% <87.09%> (-0.13%) ⬇️

... and 68 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --allow-env flag to Permission Model for restricting environment variable access

2 participants