zxlhhyccc 6041e5c4b4 luci-app-ssr-plus: fix(clash): validate DNS server and domain before ECH lookup
Problem:
fetch_ech_config() trusted the raw dns_server string:
- port extracted with dns_server:match(":(%d+)"), which misreads
  "https://1.1.1.1/dns-query:8080" as port 8080 and
  "[2001:db8::5353]:53" as port 5353.
- safe_server = server:match("^[%w%-%._]+$") accepted
  999.999.999.999, "::::" and bad..hostname.
- safe_domain = domain:match("^[%w%-%._]+$") accepted
  -example.com, example..com and a..b.
- No protocol allowlist, so tcp:// / quic:// silently degraded
  to a plain UDP 53 query.
- dig had no timeout; an unreachable DoH could stall the
  subscription conversion for the default 5s * 3 attempts.

Fix:
- Add parse_dns_server() that strips scheme, path, query and
  fragment, then extracts host[:port] with explicit handling for
  IPv6 literals. Trailing colons and empty ports are rejected.
- Add valid_dns_domain() for label-level DNS validation
  (empty label, leading/trailing hyphen, label length,
  total length).
- Add valid_ipv4() (dotted quad, no leading zeros) and
  valid_ipv6() (hextet count, single "::", max 4 hex per group).
- Add a protocol allowlist ("" / https / doh / tls / dot);
  other schemes return nil immediately.
- Enforce port range 1-65535.
- Add "+time=3 +tries=1" to dig.
- Fix command_exists() to treat whitespace-only output as absent.

Scope:
Only affects ECH config generation (fetch_ech_config) and
command_exists. ECHConfigList extraction, YAML dumping and all
other actions are unchanged. The generated ech-opts.config /
query-server-name values are byte-identical for valid inputs.
2026-11-27 22:13:50 +08:00
2022-11-17 19:42:45 +08:00
2026-07-14 01:18:28 +08:00
2026-10-18 14:12:16 +08:00
2026-10-18 14:22:33 +08:00
2025-04-22 21:18:47 +08:00
2025-04-22 21:13:39 +08:00
2025-02-08 21:40:49 +08:00
2026-11-22 21:07:29 +08:00
2026-03-27 22:20:04 +08:00
2026-10-18 14:44:24 +08:00
2025-08-25 05:28:24 +08:00
2026-03-27 00:19:37 +08:00
2026-06-15 21:37:58 +08:00
2026-02-09 00:33:10 +08:00
2026-02-28 00:35:50 +08:00
2022-06-12 20:27:03 +08:00
2024-03-01 00:51:58 +08:00

Setup instruction

Install clang first.

Method 1 - Clone this repo directly

  1. Clone this repo:

    rm -rf package/helloworld
    git clone --depth=1 https://github.com/fw876/helloworld.git package/helloworld
    
  2. Pull upstream commits:

    git -C package/helloworld pull
    
  • Remove

    rm -rf package/helloworld
    

Method 2 - Add this repo as a git submodule

  1. Add new submodule:

    rm -rf package/helloworld
    git submodule add -f --name helloworld https://github.com/fw876/helloworld.git package/helloworld
    
  2. Pull upstream commits:

    git submodule update --remote package/helloworld
    
  • Remove

    git submodule deinit -f package/helloworld
    git rm -f package/helloworld
    git reset HEAD .gitmodules
    rm -rf .git/modules{/,/package/}helloworld
    

Method 3 - Add this repo as an OpenWrt feed

  1. Add new feed:

    sed -i "/helloworld/d" "feeds.conf.default"
    echo "src-git helloworld https://github.com/fw876/helloworld.git" >> "feeds.conf.default"
    
  2. Pull upstream commits:

    ./scripts/feeds update helloworld
    ./scripts/feeds install -a -f -p helloworld
    
  • Remove

    sed -i "/helloworld/d" "feeds.conf.default"
    ./scripts/feeds clean
    ./scripts/feeds update -a
    ./scripts/feeds install -a
    

Note

⚠ For OpenWrt 21.02 or lower version

You have to manually upgrade Golang toolchain to 1.21 or higher to compile Xray-core.

S
Description
No description provided
Readme GPL-3.0
16 MiB
0 Stars 1 Watchers 0 Forks
Languages
C 64.3%
Shell 10.8%
Makefile 10%
Lua 4.8%
Roff 3.8%
Other 6.1%