fix: prevent fork bomb in TypeScript CLI when installed via npm - #239
Merged
Conversation
|
Thank you for your submission! Like many open source projects, we ask that you sign our CLA (Contributor License Agreement) before we can accept your contribution. Already signed the CLA? To re-check, try refreshing the page. |
- Add resolveFromPath() to resolve a bare binary name from PATH env var - Add isNativeExecutable() to read magic bytes (ELF/Mach-O/PE) and reject JS shims that start with a shebang or other non-native header - Update candidateCoreBinaries() to resolve 'mcp-compressor' from PATH and only include it when the resolved file is a native binary - Remove the binary !== 'mcp-compressor' special-case in runRustCoreCli() and use existsSync uniformly for all candidates Closes #238
Copilot
AI
changed the title
[WIP] Fix fork bomb issue on Linux when installed via npm
fix: prevent fork bomb in TypeScript CLI when installed via npm
Jul 14, 2026
timesler
marked this pull request as ready for review
July 14, 2026 15:52
timesler
temporarily deployed
to
atlassian-mcp-integration
July 14, 2026 15:52 — with
GitHub Actions
Inactive
timesler
approved these changes
Jul 14, 2026
Inline the ternary expression for `exts` to satisfy oxfmt format check.
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.
When
@atlassian/mcp-compressoris installed globally via npm, themcp-compressorbin entry points back todist/cli.js. The oldcandidateCoreBinaries()included the bare string"mcp-compressor"with a special-case that bypassed theexistsSyncguard, so the shim would spawn itself indefinitely.Changes
resolveFromPath(name)— resolves a bare binary name to an absolute path viaPATHdirectories (withX_OKcheck); returnsnullif not found.isNativeExecutable(filePath)— reads the first 4 bytes and matches native magic numbers (ELF\x7fELF, PEMZ, Mach-O variants). A JS shim starting with#!returnsfalse.candidateCoreBinaries()— replaces the bare"mcp-compressor"push with aresolveFromPath+isNativeExecutableguard; only the resolved absolute path is added when confirmed native.runRustCoreCli()— drops thebinary !== "mcp-compressor"special-case;existsSyncis now applied uniformly to all candidates.