Skip to content

permission: support URL and Uint8Array as has()/drop() reference - #65492

Open
nhjbest22 wants to merge 1 commit into
nodejs:mainfrom
nhjbest22:permission-reference-types
Open

permission: support URL and Uint8Array as has()/drop() reference#65492
nhjbest22 wants to merge 1 commit into
nodejs:mainfrom
nhjbest22:permission-reference-types

Conversation

@nhjbest22

Copy link
Copy Markdown

process.permission.has()/drop() only accepted a string or Buffer for
the reference argument. This adds support for a WHATWG URL, resolved
via fileURLToPath() for fs.* scopes since those are the only scopes
that actually use the reference value, and a plain Uint8Array.

Also switches permission.cc from Utf8Value to BufferValue when reading
a Buffer/TypedArray reference, since Utf8Value forces a UTF-8 string
conversion that can silently corrupt a path that isn't valid UTF-8.

normalizeReference() adds URL and Uint8Array support to has()/drop();
the existing string/Buffer behavior is unchanged. BufferValue replaces
Utf8Value so a Buffer/TypedArray reference is copied as raw bytes
instead of a lossy UTF-8 conversion.

Signed-off-by: seungmin Nam <nhjbest22@g.skku.edu>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem. labels Aug 22, 2026
@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.69767% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.13%. Comparing base (cf30b2e) to head (6d518fc).
⚠️ Report is 97 commits behind head on main.

Files with missing lines Patch % Lines
src/permission/permission.cc 72.72% 0 Missing and 3 partials ⚠️
lib/internal/process/permission.js 96.87% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65492      +/-   ##
==========================================
+ Coverage   90.11%   90.13%   +0.02%     
==========================================
  Files         752      751       -1     
  Lines      251861   252530     +669     
  Branches    47365    47512     +147     
==========================================
+ Hits       226955   227623     +668     
+ Misses      16238    16213      -25     
- Partials     8668     8694      +26     
Files with missing lines Coverage Δ
lib/internal/process/permission.js 92.39% <96.87%> (+10.68%) ⬆️
src/permission/permission.cc 75.98% <72.72%> (+0.76%) ⬆️

... and 104 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++. needs-ci PRs that need a full CI run. process Issues and PRs related to the process subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants