Files
OmniRoute/src/lib/proxyRelay
SeaXen c6598fdd19 fix(cloudflare-relay): avoid invalid regex syntax in generated worker (#7063)
* fix(cloudflare-relay): avoid regex syntax in generated worker

CONTEXT: release/v3.8.47 still emitted a Cloudflare Worker body that parsed as invalid JavaScript in production, surfacing as 'Invalid regular expression flags' during upload.

CHANGE: replace the trailing-slash regex cleanup with simple endsWith/slice string handling and add a regression check that parses the generated worker body in a child Node process.

WHY: Cloudflare accepted the #6496 Service Worker/body_part fix, but the generated script still contained parser-sensitive regex source that broke worker deployment.

IMPACT: one-click Cloudflare relay deploys generate valid worker code and the regression test now documents the exact parse failure from the pre-fix source.

* test(cloudflare-relay): avoid eval-style worker validation

CONTEXT: PR #7063 reviewer flagged Hard Rule 3 violations in the regression test because it used new Function(...) and node:vm.\n\nCHANGE: rewrite the worker syntax/behavior check to use only temp files plus isolated child processes (node --check for syntax, node temp-file.js for IPv6 guard assertions).\n\nWHY: preserves the exact regression coverage without eval-like constructs.\n\nIMPACT: reviewer concern is addressed and the focused Cloudflare regression suite remains green.

* refactor(proxy-relay): compact private-host checks (complexity-ratchet lines budget on buildCloudflareWorkerScript)

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
2026-07-18 21:19:09 -03:00
..