Repository navigation
fix(io): honor Unix executable permission classes and supplementary groups - #2590
Open
pradeep-ramola wants to merge 1 commit into
Open
pradeep-ramola wants to merge 1 commit into
pradeep-ramola wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Unix executable detection used by
which/tryGetExecutablePathin@actions/io.The existing check only considers the primary group, so it misses executables whose group execute permission is granted through a supplementary group. It also combines permission classes with OR: a file owned by the current user with mode
0011is reported executable even though its owner execute bit is unset.Select the applicable permission class instead:
This retains the existing stat-based, best-effort approach. It does not add ACL, capability, or mount-option checks. Windows executable detection and the public API are unchanged.
References: Node's getgroups API and the Linux permissions model.
Tests
Added 20 deterministic tests through
tryGetExecutablePathcovering supplementary groups, extension fallback, permission-class precedence, effective identities, root execute bits, and existing owner/group/other behavior. The initial supplementary-group regression run had 3 failures and 7 passing controls before the implementation change.Validation on Windows:
npm test -- --runInBand packages/io: 76 tests passing across 2 suites.node node_modules/typescript/bin/tsc -p packages/io/tsconfig.json --noEmitgit diff --checkThe new tests mock file stats and process identity APIs to exercise the Unix branch on Windows, restoring the original descriptors after each test. I have not run a native Linux/macOS integration test or the entire toolkit monorepo suite.
AI Assistance
Developed with assistance from OpenAI Codex, including implementation and local test execution.