mirror of
https://github.com/fw876/helloworld.git
synced 2026-12-05 08:01:07 +00:00
dashboard
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.
Setup instruction
Install clang first.
Method 1 - Clone this repo directly
-
Clone this repo:
rm -rf package/helloworld git clone --depth=1 https://github.com/fw876/helloworld.git package/helloworld -
Pull upstream commits:
git -C package/helloworld pull
-
Remove
rm -rf package/helloworld
Method 2 - Add this repo as a git submodule
-
Add new submodule:
rm -rf package/helloworld git submodule add -f --name helloworld https://github.com/fw876/helloworld.git package/helloworld -
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
-
Add new feed:
sed -i "/helloworld/d" "feeds.conf.default" echo "src-git helloworld https://github.com/fw876/helloworld.git" >> "feeds.conf.default" -
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.
Languages
C
64.3%
Shell
10.8%
Makefile
10%
Lua
4.8%
Roff
3.8%
Other
6.1%