Skip to content

fix(io): honor Unix executable permission classes and supplementary groups - #2590

Open
pradeep-ramola wants to merge 1 commit into
actions:mainfrom
pradeep-ramola:fix/io-supplementary-groups
Open

pradeep-ramola wants to merge 1 commit into
actions:mainfrom
pradeep-ramola:fix/io-supplementary-groups

Conversation

@pradeep-ramola

Copy link
Copy Markdown

Summary

Fix Unix executable detection used by which / tryGetExecutablePath in @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 0011 is reported executable even though its owner execute bit is unset.

Select the applicable permission class instead:

  • Use effective user/group IDs where available, falling back to the existing real-ID APIs.
  • Check owner permissions first, then primary or supplementary group permissions, then other permissions.
  • For uid zero, require at least one execute bit on a regular file.

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 tryGetExecutablePath covering 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 --noEmit
  • ESLint and Prettier checks on both changed files.
  • git diff --check

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

@pradeep-ramola
pradeep-ramola requested a review from a team as a code owner November 23, 2026 02:18

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant