You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Reject IPv6 aliases of 169.254.169.254 (IPv4-compatible / IPv4-mapped /
6to4 / NAT64) via numeric range check on parsed IPv6.
- Disable HTTP redirects on the Eth RPC request.
- Restrict SimplexName labels to ASCII (Cyrillic/Greek/full-width otherwise
hash to different on-chain records and diverge from UTS-46 registrars).
- pingEndpoint: only JsonRpcErr means "reachable"; transport/decode failures
fail startup. boundedIniInt: readMaybe over partial read.
- Add 127.0.0.0/8 and 0.0.0.0 to isLoopback.
- Replace hand-rolled hex helpers with Data.ByteArray.Encoding; raise
managerConnCount to match rpcMaxConcurrency; hex Show for NameOwner.
- Fuse parallel http/https when into unless+case; drop reverse/re-reverse
in mkDomain TLDWeb; first AbiInvariantViolated; Nothing <$ decodeAddress;
forM_ (eitherToMaybe ...); >>= chain in NameOwner FromJSON.
- Drop dead imports/exports/pragmas and two restating comments.
- Tests: factor unsafeOwner/unsafeLink, addr1/2/3, testNamesConfig; add
non-ASCII label rejection coverage.
-- against operator-misconfig footguns: 16 MiB response cap (worst-case
828
830
-- per-call memory), 60 s timeout (no operator wants RSLV to hang longer),
829
831
-- 1024 concurrent RPCs (any higher should run a separate names router).
830
-
boundedIniInt def floor_ ceiling_ key =case readIniDefault def "NAMES" key ini of
831
-
n | n >= floor_ && n <= ceiling_ -> n
832
-
|otherwise->
833
-
error$"[NAMES] "<>T.unpack key <>" must be in ["<>show floor_ <>".."<>show ceiling_ <>"] (got "<>show n <>")"
832
+
boundedIniInt def floor_ ceiling_ key =case lookupValue "NAMES" key ini of
833
+
Left _ -> def
834
+
Right raw ->case readMaybe (T.unpack (T.strip raw)) of
835
+
Nothing->
836
+
error$"[NAMES] "<>T.unpack key <>": not an integer (got "<>show raw <>")"
837
+
Just n
838
+
| n >= floor_ && n <= ceiling_ -> n
839
+
|otherwise->
840
+
error$"[NAMES] "<>T.unpack key <>" must be in ["<>show floor_ <>".."<>show ceiling_ <>"] (got "<>show n <>")"
834
841
835
842
--| Hardcoded SNRC contract whitelist. Placeholder addresses until the
836
843
-- launch contracts are deployed; replaced in code rather than INI so
@@ -873,7 +880,10 @@ validateUrl url auth_ = do
873
880
when (null host) $Left"empty host"
874
881
when (isBareIntegerHost host) $
875
882
Left"bare-integer host not allowed (use a hostname or dotted-quad / bracketed IP); rejects 169.254.169.254 decimal/hex aliases"
876
-
when (isLinkLocal host) $Left"link-local host not allowed (rejects cloud metadata services)"
883
+
when (isObfuscatedIpv4 host) $
884
+
Left"non-canonical IPv4 form not allowed (use dotted-quad decimal 0-255 with no leading zeros); rejects inet_aton hex/octal/compact aliases of 169.254.169.254"
885
+
when (isLinkLocal host || isForbiddenIpv6 host) $
886
+
Left"link-local host not allowed (rejects cloud metadata services and IPv6 aliases of 169.254.0.0/16)"
877
887
unless (null (uriUserInfo ua)) $Left"userinfo (user:pass@) not allowed; use rpc_auth instead"
878
888
case uriPort ua of
879
889
""->Left"explicit port required (e.g. http://host:8545)"
@@ -886,26 +896,36 @@ validateUrl url auth_ = do
886
896
let path = uriPath uri
887
897
unless (path ==""|| path =="/") $
888
898
Left"URL path not allowed; API keys embedded in the path leak to logs — use rpc_auth instead"
889
-
when (scheme =="http:"&¬ (isLoopback host)) $
890
-
Left"http endpoint on a non-loopback host not allowed (plaintext leaks rpc_auth); use https"
891
-
when (scheme =="https:"&¬ (isLoopback host) && isNothing auth_) $
892
-
Left"https endpoint on a non-loopback host requires rpc_auth"
899
+
unless (isLoopback host)$case scheme of
900
+
"http:"->Left"http endpoint on a non-loopback host not allowed (plaintext leaks rpc_auth); use https"
901
+
"https:"| isNothing auth_ ->Left"https endpoint on a non-loopback host requires rpc_auth"
902
+
_ ->Right()
893
903
Right url
894
904
where
895
-
isLoopback h = h =="127.0.0.1"|| h =="localhost"|| h =="[::1]"
896
-
-- IPv4 link-local 169.254.0.0/16, the IPv6 link-local prefix fe80::/10,
897
-
-- and IPv4-mapped IPv6 forms of the cloud-metadata IP 169.254.169.254
898
-
-- in every textual variant: dotted-quad, hex `a9fe:a9fe`, and the
0 commit comments