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
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