{"id":34627726,"url":"https://github.com/socketdev/socket-btm","last_synced_at":"2026-05-08T00:03:05.995Z","repository":{"id":323751374,"uuid":"1092122186","full_name":"SocketDev/socket-btm","owner":"SocketDev","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-02T04:13:33.000Z","size":1461,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-02T06:21:44.286Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SocketDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-08T03:15:48.000Z","updated_at":"2026-04-01T20:12:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/SocketDev/socket-btm","commit_stats":null,"previous_names":["socketdev/socket-btm"],"tags_count":314,"template":false,"template_full_name":null,"purl":"pkg:github/SocketDev/socket-btm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketDev%2Fsocket-btm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketDev%2Fsocket-btm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketDev%2Fsocket-btm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketDev%2Fsocket-btm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SocketDev","download_url":"https://codeload.github.com/SocketDev/socket-btm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketDev%2Fsocket-btm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31580507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T16:10:50.730Z","updated_at":"2026-05-08T00:03:05.964Z","avatar_url":"https://github.com/SocketDev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Socket BTM\n\nBuild infrastructure for Socket's binary artifacts and ML models.\n\n## What is Socket BTM?\n\nSocket BTM (Binary Tooling Manager) is Socket Security's build infrastructure for creating custom Node.js binaries, binary manipulation tools, and machine learning models.\n\n**Why does this exist?** Socket Security needs to:\n\n- Build custom Node.js binaries with security enhancements and embedded capabilities (VFS, SEA)\n- Create tools to inject data into binaries without recompilation (binject)\n- Compress and decompress binaries while preserving functionality (binpress, binflate)\n- Ship optimized ML models for security analysis (CodeT5, MiniLM)\n\n**What can you do with it?**\n\n- Build a custom Node.js binary (~23-27MB) with Socket's security patches\n- Embed files into executables using Virtual File System (VFS)\n- Create Single Executable Applications (SEA) from Node.js apps\n- Compress binaries for smaller distribution size\n- Build WASM modules for browser and server-side use\n\n**Who is this for?** Developers working on Socket's internal tools, contributing to Socket's open source projects, or building custom Node.js distributions.\n\n## Overview\n\nMonorepo containing:\n\n- **Binary Tools** - binject, binpress, binflate (C/C++ binary manipulation)\n- **Node.js** - Custom Node.js v26 with Socket security patches\n- **WASM** - ONNX Runtime and Yoga Layout\n- **ML Models** - Quantized AI models (CodeT5, MiniLM)\n\n## Core Concepts\n\nIf you're new to binary manipulation or Node.js customization, here are the key concepts you'll encounter:\n\n### Single Executable Application (SEA)\n\nA Node.js program bundled into a single executable file. Instead of shipping `node` + `.js` files, you get one `.exe`/binary that contains everything. This makes distribution easier and protects source code.\n\n**Example:** `my-app.exe` contains both Node.js runtime and your application code.\n\n### Virtual File System (VFS)\n\nA filesystem embedded inside a binary. Your executable can read \"files\" that are actually data baked into the binary itself. No need to extract files to disk first.\n\n**Example:** Your binary contains `config.json` and `index.js` internally, accessed via normal `fs.readFile()` calls.\n\n### Binary Injection\n\nModifying a compiled binary without recompiling from source. We insert data into special sections of executables (Mach-O on macOS, ELF on Linux, PE on Windows).\n\n**Example:** Take `node` binary, inject a VFS archive into it, output `node-with-vfs`.\n\n### LIEF (Library for Instrumenting Executable Formats)\n\nA C++ library for reading and modifying executable formats (Mach-O, ELF, PE). We use it to inject data into binaries safely without corrupting them.\n\n### Checkpoints\n\nIncremental build caching system. Each build stage (copy sources → apply patches → compile → strip → compress) saves a checkpoint. If source hasn't changed, we skip rebuilding.\n\n**Example:** Building Node.js takes 30 minutes from scratch, but only 2 minutes if you only changed one patch file.\n\n### Compression (zstd)\n\nReducing binary size for distribution. Compressed binaries self-extract at runtime.\n\n**Example:** 60MB Node.js binary → 23MB compressed binary (saves bandwidth, faster downloads).\n\n## Quick Start\n\n`binject` / `binpress` depend on a prebuilt LIEF artifact, and `stubs-builder` depends on prebuilt curl+mbedTLS; both are fetched automatically from this repo's GitHub releases on first build. Pass `pnpm --filter \u003cbuilder\u003e run build -- --force` if you need to compile those libraries from source (e.g. an unsupported platform or a LIEF/curl bump that hasn't been published yet).\n\n```bash\n# Install dependencies\npnpm install\n\n# Build binary tools\npnpm --filter binject run build\npnpm --filter binpress run build\npnpm --filter binflate run build\n\n# Build Node.js\npnpm --filter node-smol-builder run build\n\n# Build WASM modules\npnpm --filter onnxruntime-builder run build\npnpm --filter yoga-layout-builder run build\n\n# Build ML models\npnpm --filter codet5-models-builder run build\npnpm --filter minilm-builder run build\npnpm --filter models run build\n```\n\n## Development\n\n### Git Hooks\n\nThis repository uses [Husky](https://typicode.github.io/husky/) for git hooks:\n\n**Pre-commit Hook** (optional quality checks):\n\n- Runs linting on staged files (`pnpm lint --staged`)\n- Runs tests on staged test files (`pnpm test --staged`)\n- Can be bypassed with `git commit --no-verify` for fast local commits, history operations (squash, rebase, amend), or emergency hotfixes\n- Selectively disable checks with environment variables:\n  - `DISABLE_PRECOMMIT_LINT=1` - Skip linting\n  - `DISABLE_PRECOMMIT_TEST=1` - Skip testing\n\n**Pre-push Hook** (mandatory security checks):\n\n- Runs security validation before pushing to remote\n- Cannot be bypassed\n\n**Setup**:\nGit hooks are automatically installed when running `pnpm install` (via the `prepare` script).\n\n**Windows Requirements**:\nGit hooks use bash scripts and require [Git Bash](https://gitforwindows.org/) or [WSL](https://docs.microsoft.com/en-us/windows/wsl/install) on Windows systems.\n\n## Packages\n\n### Binary Tools\n\n- [binject](packages/binject/) - Binary injection (Mach-O, ELF, PE)\n- [binpress](packages/binpress/) - Binary compression (zstd)\n- [binflate](packages/binflate/) - Binary decompression utility\n\n### Infrastructure\n\n- [build-infra](packages/build-infra/) - Shared build utilities (checkpoints, CMake, Rust, WASM)\n- [bin-infra](packages/bin-infra/) - Binary infrastructure (LIEF, compression, format handling)\n- [stubs-builder](packages/stubs-builder/) - Self-extracting stub binaries for compressed executables\n- [curl-builder](packages/curl-builder/) - Curl static library builder\n- [lief-builder](packages/lief-builder/) - LIEF library builder\n- [libpq-builder](packages/libpq-builder/) - libpq PostgreSQL client library with OpenSSL support\n\n### Node.js\n\n- [node-smol-builder](packages/node-smol-builder/) - Custom Node.js v26 with Socket security patches\n\n### WASM Builders\n\n- [onnxruntime-builder](packages/onnxruntime-builder/) - ONNX Runtime WASM module builder\n- [yoga-layout-builder](packages/yoga-layout-builder/) - Yoga Layout WASM module builder\n\n### UI Libraries\n\n- [ink-builder](packages/ink-builder/) - Prepatched Ink with yoga-sync\n- [iocraft-builder](packages/iocraft-builder/) - Native Node.js bindings for iocraft TUI library via napi-rs\n- [opentui-builder](packages/opentui-builder/) - Native Node.js bindings for OpenTUI library via Zig node-api\n- [ultraviolet-builder](packages/ultraviolet-builder/) - Charmbracelet Ultraviolet terminal decoder (kitty/fixterms/SGR) compiled from Go via napi-go-infra\n\n### N-API Frameworks\n\n- [napi-go-infra](packages/napi-go-infra/) - Go → N-API framework (the napi-rs analog for Go), source-distributed from this repo\n\n### ML Models\n\n- [codet5-models-builder](packages/codet5-models-builder/) - CodeT5 model quantization\n- [minilm-builder](packages/minilm-builder/) - MiniLM model quantization\n- [models](packages/models/) - ML model distribution package\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketdev%2Fsocket-btm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketdev%2Fsocket-btm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketdev%2Fsocket-btm/lists"}