Skip to content

typings: add credentials internal binding types - #65036

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
HoonDongKang:typings-internalbinding-credentials
Aug 12, 2026
Merged

typings: add credentials internal binding types#65036
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
HoonDongKang:typings-internalbinding-credentials

Conversation

@HoonDongKang

@HoonDongKang HoonDongKang commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Add typings for the credentials internal binding.

Changes:

  • Added typings/internalBinding/credentials.d.ts
  • Added credentials to InternalBindingMap
  • Typed safeGetenv() and getTempDir()
  • Typed optional POSIX credential helpers exposed during bootstrap:
    • implementsPosixCredentials
    • getuid?()
    • geteuid?()
    • getgid?()
    • getegid?()
    • getgroups?()
    • initgroups?()
    • setegid?()
    • seteuid?()
    • setgid?()
    • setuid?()
    • setgroups?()

Add a CredentialsBinding declaration for internalBinding('credentials')
and wire it into InternalBindingMap.

Signed-off-by: HoonDongKang <d159123@naver.com>
@daeyeon

daeyeon commented Aug 9, 2026

Copy link
Copy Markdown
Member

These methods appear to be optional, as they are not available on every platform.

#ifdef NODE_IMPLEMENTS_POSIX_CREDENTIALS
Environment* env = Environment::GetCurrent(context);
Isolate* isolate = env->isolate();
READONLY_TRUE_PROPERTY(target, "implementsPosixCredentials");
SetMethodNoSideEffect(context, target, "getuid", GetUid);
SetMethodNoSideEffect(context, target, "geteuid", GetEUid);
SetMethodNoSideEffect(context, target, "getgid", GetGid);
SetMethodNoSideEffect(context, target, "getegid", GetEGid);
SetMethodNoSideEffect(context, target, "getgroups", GetGroups);
if (env->owns_process_state()) {
SetMethod(context, target, "initgroups", InitGroups);
SetMethod(context, target, "setegid", SetEGid);
SetMethod(context, target, "seteuid", SetEUid);
SetMethod(context, target, "setgid", SetGid);
SetMethod(context, target, "setuid", SetUid);
SetMethod(context, target, "setgroups", SetGroups);
}
#endif // NODE_IMPLEMENTS_POSIX_CREDENTIALS

Signed-off-by: HoonDongKang <d159123@naver.com>
@HoonDongKang

HoonDongKang commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I missed that these methods can be conditionally exposed.

I kept safeGetenv() and getTempDir() required, and updated the POSIX credential helpers to be optional.

@daeyeon daeyeon added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Aug 11, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 11, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/65036
✔  Done loading data for nodejs/node/pull/65036
----------------------------------- PR info ------------------------------------
Title      typings: add credentials internal binding types (#65036)
Author     Donghoon Kang <d159123@naver.com> (@HoonDongKang)
Branch     HoonDongKang:typings-internalbinding-credentials -> nodejs:main
Labels     author ready, commit-queue, typings, commit-queue-squash
Commits    2
 - typings: add credentials internal binding types
 - typings: make credentials methods optional
Committers 1
 - HoonDongKang <d159123@naver.com>
PR-URL: https://github.com/nodejs/node/pull/65036
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/65036
--------------------------------------------------------------------------------
   ⚠  No approving reviews found
   ℹ  This PR was created on Wed, 05 Aug 2026 06:24:41 GMT
   ✘  Approvals: 0
   ✔  Last GitHub CI successful
   ℹ  Green GitHub CI is sufficient
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/31461424057

@daeyeon daeyeon added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Aug 11, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 69bf457 into nodejs:main Aug 12, 2026
34 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 69bf457

@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. typings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants