Reashield

io.github.HMAKT99由 GitHub 帳號 HMAKT99 發布v0.7.1更新於 Nov 5, 2026

Defensive hardening against automated reverse engineering - the defensive mirror of REA.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

此 MCP 伺服器為 AI 助理提供工具,用來檢查、加固並量測 JavaScript/Electron/Python 專案,抵禦自動化逆向工程。

可以做什麼
  • 檢查專案的暴露面、設定、加固層與成本
  • 加固已發布的程式碼:伺服器端搬移、加密封裝、WASM、混淆與誘餌
  • 執行真實的 REA 攻擊工具,比較加固前後並給出還原評分
  • 為搬移或封裝的邏輯產生伺服器骨架
適用情境
當你發布自己擁有的 JavaScript、Electron 或 Python 程式碼,希望在對話中讓助理加以加固以抵禦自動化逆向工程,並量測攻擊工具仍能還原多少內容時使用。
執行需求
以本機 stdio 程序執行,通常透過 npx 啟動。JavaScript/Electron 前端需要 Node.js 與 npm;Python 前端需另行安裝。真實攻擊量測需要選用的 rea-agents 套件,否則只提供靜態代理指標。
安裝前請注意
加固會改寫建置產物,並可能產生含真實邏輯與金鑰的伺服器骨架,絕不可隨應用發布。在提供驗證器之前,產生的端點處於開放狀態,確保其安全是你的責任。搬移或封裝的函式會變成非同步,且必須自足。離線程式碼永遠無法做到無法破解。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Reashield,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

REAShield

[npm version] [license] [CI] [python-ci]

[REAShield demo — REA recovers 6 protected tokens, 0 after hardening]

REA reverse-engineers any app. REAShield makes it come back empty.

REA — the #1 trending repo on GitHub — lets an AI agent reverse-engineer your shipped app in one command, no source code needed. REAShield is the defensive counter: drop it into your build and it hardens what you ship (JavaScript / Electron / Python) so automated reverse engineering comes back empty.

Measured against the real attacker — not claimed

  • REA (rea-agents) recovered 6 protected tokens → 0 after hardening.
  • webcrack fully deobfuscated the hardened client (1103 changes, string array decoded) and still recovered 0 — because the secrets were relocated/sealed, not just obfuscated.
bash
npm i -D reashieldnpx reashield build        # hardened client + generated server skeletonnpx reashield test --rea   # run the REAL REA on before/after; score what it recovers

Python front-end: pip install reashield (see python/).

Honest promise & limits — read this

Offline code can never be made unbreakable. If a machine must run it, the machine has it, so it can always be extracted given effort — obfuscation, WASM and bytecode only raise the cost. REAShield's job is to defeat the automated attack (the one REA just handed everyone) and raise a human analyst's cost from minutes to days. The only truly unrecoverable code is code you don't ship — run it server-side (mode: "relocate"). Defensive-only, behavior-preserving, transparent (no phone-home). It hardens code you own and ship; it won't help bypass anyone else's DRM, license checks, or anti-cheat.


Use it from an AI agent (MCP server)

REA is an MCP server that hands an agent reverse-engineering tools. REAShield ships the defensive mirror — an MCP server that hands an agent hardening tools, so Claude Code / Cursor can inspect, harden, and measure a project from chat.

Tools: reashield_doctor (what's exposed), reashield_harden (harden it), reashield_measure (run the real REA and report the recovery score).

bash
# Claude Codeclaude mcp add reashield -- npx -y reashield-mcp
# Cursor / other MCP clients — add to your MCP config:# { "mcpServers": { "reashield": { "command": "npx", "args": ["-y", "reashield-mcp"] } } }

Two front-ends, one architecture

REAShield is a monorepo. The same durable idea — move secrets off-device, turn static facts into runtime facts, and measure the result — is implemented for two ecosystems:

Front-endInstallProtectsStatus
JavaScript / npm / Electron (this package)npm i -D reashieldshipped JS bundles, app.asarpublished
Python (python/)pip install -e pythonshipped .py appsin this repo

Both share the pillar ordering below. The Python package mirrors relocation, sealing (AES-GCM), string indirection, name mangling, polymorphism, decoys, and a measurement harness — with a safety analyzer that refuses rather than miscompiles. See python/README.md.

Interpreted / source-shipped languages are the natural fit; compiled-to-native (Go, Rust, C/C++) ship no source and are a different reverse-engineering game.


Why this works (the threat model)

REA's JavaScript/Electron path is static — it never runs your app. It reads your bundle, rebuilds a graph of modules, imports, routes, IPC channels and strings, then hands a coding agent a compact summary to reason over. It honestly leaves anything computed at runtime unresolved and drops relationships when a graph gets too big.

So the durable defenses either move secrets off-device or turn static facts into runtime facts REA can't resolve. Plain obfuscation — the thing LLM-assisted deobfuscation erodes fastest — is the replaceable outer skin, not the foundation.

Defense pillars (ordered by durability)

Pillarmode / layerWhat it doesHonest limit
Server-side relocationrelocateMoves the real body to a generated server skeleton; ships only an opaque remote-call stub through one endpoint. The secret never ships.Needs a secured backend; the request/response boundary is observable.
Encrypted sealing (max)sealShips the module as ciphertext, decrypted at runtime with a key fetched from your server.Needs connectivity; does not stop a human dumping decrypted memory.
WASMwasmCompiles numeric-subset logic to a real WebAssembly module, off REA's JS graph path.Numeric subset only; falls back to obfuscate (reported) outside it; wasm can still be decompiled.
Dynamic graph (max)dynamicGraphComputed imports + runtime dispatch table — deletes the call/import edges REA recovers.CPU cost; scoped to protected regions.
Graph starvationflattenBundle, stripSourceMaps, stringIndirection, dynamicChannelsOne module, no maps, no semantic plaintext strings, computed channel names.Obfuscation erodes over time.
PolymorphismpolymorphicPer-build re-randomization of names, strings and structure — defeats version diffing.Cosmetic alone; pairs with the above.
DecoysdecoysInert fake "feature" clusters (hub + ring-linked members + a fake entry) with plausible route/IPC/key strings, shaped to look central in REA's summary.Experimental; measured, can add size.
Integrityintegrity (off)Fail-safe anti-tamper.Does not defend REA's static path (REA never runs your app).

Install

bash
npm install --save-dev reashield

Quick start

bash
npx reashield init          # scaffold shield.config.cjsnpx reashield build         # emit hardened client + server skeletonnpx reashield doctor        # show config, layers, costs, depsnpx reashield test          # measure before vs after (static; add --rea for real REA)

Config (shield.config.cjs)

js
module.exports = {  input: "src/index.js",  output: "dist-shielded",  preset: "balanced",            // low | balanced | max  protect: [    { name: "licenseCheck", mode: "relocate" },  // strongest: off-device    { name: "sealedCalc",   mode: "seal" },        // ciphertext + remote key (max)    { name: "pricingLogic", mode: "wasm" },        // off the JS graph (fast-follow)    { name: "featureGate",  mode: "obfuscate" },   // harden in place  ],  server: {    enabled: true, out: "server-shielded", adapter: "express",    endpoint: "/__s", keyEndpoint: "/__s/k", decoyCalls: false,  },  polymorphic: { enabled: true, seed: "auto" },     // "auto" rotates every build  layers: {    stripSourceMaps: true, flattenBundle: true, obfuscate: true,    stringIndirection: true, dynamicChannels: true, dynamicGraph: false,    decoys: { enabled: true, count: 5 }, integrity: false,  },};

protect: ["a", "b"] (a plain string array) is also accepted; each defaults to mode: "obfuscate". You can also put the config under a reashield key in package.json.

Presets

  • low — strip maps, flatten, mangle. Fast, minimal size.
  • balanced (default) — + string indirection, name homogenization, computed channels, opaque relocation boundary, structural polymorphism, 5 decoys. Low cost.
  • max — + dynamic dispatch, encrypted sealing, decoy calls, control-flow flattening, dead-code injection, self-defending, ~15 decoys. Adds latency / CPU / size — doctor flags it.

Bundler plugins (run hardening inside your existing build)

Instead of the CLI, harden as part of an esbuild / Rollup / Vite build. The plugin runs the source-level pillars per module, then finalizes each output chunk (decoys + obfuscation + source-map stripping + client-runtime injection) and writes the server skeleton. flattenBundle is a no-op here — your bundler already bundles; the plugin hardens its output. Configure the relocated/sealed transport once via the global the plugin installs: globalThis.__configureShield({ transport, keyTransport }) (or let the default fetch transport call your endpoints).

js
// rollup.config.mjsimport { reashieldRollup } from "reashield/plugins";export default {  input: "src/index.js",  output: { dir: "dist", format: "esm" },  plugins: [reashieldRollup({ configPath: "shield.config.cjs" })],};
js
// vite.config.mjs  (Vite consumes the Rollup plugin interface)import { reashieldVite } from "reashield/plugins";export default { plugins: [reashieldVite({ configPath: "shield.config.cjs" })] };
js
// esbuild build scriptimport { build } from "esbuild";import { reashieldEsbuild } from "reashield/plugins";await build({  entryPoints: ["src/index.js"],  bundle: true,  outdir: "dist",  plugins: [reashieldEsbuild({ configPath: "shield.config.cjs" })],});

Each plugin accepts { config | configPath, cwd, seed }. Note: the plugin hardens every emitted JS chunk, so obfuscation cost applies to the whole output — scope your build accordingly.

The generated server skeleton

relocate and seal emit a server-shielded/ directory holding the real logic and keys. Never ship it to users. You run it behind your own auth + TLS. REAShield scaffolds the Express/Fastify wiring and an in-process handler for tests; securing the endpoint is your responsibility (it does not add auth for you).

Auth seam (you supply it). Until you call setAuthVerifier, the endpoint is open — secure it before shipping. The client attaches a token from a source you configure; the server verifies it:

js
// serverimport { setAuthVerifier } from "./server-shielded/handlers.js";setAuthVerifier(async (token, ctx) => (await myAuth.verify(token)) === true);
// client (wire once at startup)__configureShield({ authToken: () => myAuth.currentToken() }); // (or globalThis.__configureShield in plugin builds)

Adapters. adapter: "express" | "fastify" | "web" | "generic". The skeleton always exports a cross-runtime webHandler(request: Request): Promise<Response> that drops into Hono, Cloudflare Workers, Deno, Bun, or a Next.js route handler:

js
import { webHandler } from "./server-shielded/handlers.js";export const POST = (req) => webHandler(req); // Next.js app route, Workers fetch, ...

Relocated/sealed functions become async (they do a round-trip). Make sure your call sites await them. They must be self-contained (no closure over client-only module state).

Behavior preservation

Hardening must never change what your program does. The bundled example (examples/sample-package) proves identical outputs before and after hardening — including relocated and sealed code, exercised through an in-process server — and asserts decoys never execute. Run it with npm run example:test.

Electron hardening

For Electron apps, REAShield adds an Electron-specific path (pair it with the JS pillars above):

  • Dynamic IPC channel rewriting — turns literal ipcMain/ipcRenderer/ webContents channel strings into runtime-computed ones. REA leaves dynamically-computed IPC names unresolved by design, so this directly starves its graph. Value-preserving: both sides compute the identical string. Enable with layers.ipcChannels: true, or run standalone:
    bash
    npx reashield electron ipc src/main.js --out dist/main.js
  • V8 bytecode (bytenode) — ship .jsc so the asar holds no readable JS:
    bash
    npx reashield electron bytecode dist/main.js --out dist/main.jsc
    Caveat: V8 bytecode is tied to the exact V8 version — compile with your target Electron's Node/V8, or the .jsc will not load. Raises cost against automated static JS analysis; it is not unbreakable.
  • Defensive fuses (@electron/fuses) — flip the packaged binary to the hardened defaults (disable RunAsNode, Node CLI inspect args and NODE_OPTIONS; enable embedded ASAR integrity validation and OnlyLoadAppFromAsar). Run after packaging, in your afterPack:
    bash
    npx reashield electron fuses path/to/YourApp   # --dry to preview

bytenode and @electron/fuses are optional dependencies, loaded only when you use these commands. Programmatic API: import { rewriteIpcChannels, compileToBytecode, recommendedFuses, applyFuses } from "reashield/electron".

WASM backend (numeric crown jewels)

Mark a function mode: "wasm" and REAShield compiles it to a real WebAssembly module (emitted as binary — no external toolchain) that is instantiated synchronously, so behavior is unchanged. The arithmetic then lives in wasm bytes, off REA's JS module-graph path. Supported today: numeric params, const locals, a return, + - * /, unary -, ternaries with comparison/&&/||/! conditions, and Math.(max|min|abs|floor|ceil|round|sqrt|trunc). Anything outside that subset falls back to in-place obfuscation, reported (never silent). Honest limit: wasm is a harder, different analysis league — not unbreakable.

Durability: measure, don't trust

REA ships often. reashield test compares your own before/after artifact and writes a baseline; the committed GitHub Action (.github/workflows/reashield-regression.yml) re-measures across a matrix of rea-agents versions and fails when a newer REA recovers more than the baseline allows. That regression gate — not any single obfuscation trick — is what keeps the shield strong over time.

rea-agents is an optional dev dependency. Without it, reashield test falls back to static proxy metrics (source maps, import edges, string leakage, protected-name leakage, secret-string removal).

Roadmap

✅ Bundler plugins (esbuild/Rollup/Vite) · ✅ Electron path (bytenode, defensive fuses, dynamic IPC rewriting) · ✅ WASM backend (numeric-subset → real wasm).

Next: broader WASM subset (control flow, strings) · broader server adapters + auth helpers · summary-view-tuned decoys · ASAR packaging integration helpers.

License

MIT. Use it to protect code you own and ship. Nothing here is a weapon against anyone else's software.

來源:README.md,提交 2c2efff

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:伺服器未能啟動。

版本歷史

1
  1. v0.7.1最新Nov 5, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分