data: keep CodeQL off a blank UDP group and a test channel name (#1006)

This commit is contained in:
Afri authored and GitHub committed 2026-10-08 15:41:08 +02:00
1 parent 6c9e0bad52
commit 86c7f52a69
3 files changed
+42 -20

No files matched your search

+11 -7
View File
@@ -397,19 +397,23 @@ def _parse_mesh_udp_groups(raw: str) -> tuple[str, ...]:
if not entry:
continue
try:
is_multicast = ipaddress.IPv4Address(entry).is_multicast
address = ipaddress.IPv4Address(entry)
except ValueError: # not an IPv4 address at all
is_multicast = False
if not is_multicast:
address = None
if address is None or not address.is_multicast:
raise ValueError(
f"MESH_UDP_GROUP entry {entry!r} is not an IPv4 multicast address "
"(224.0.0.0/4). Set one address or a comma-separated list, "
'e.g. "239.0.0.69,224.0.0.69".'
)
# IPv4Address accepts only canonical dotted-decimal (no leading
# zeros), so the raw entry is already the normalised spelling.
if entry not in groups:
groups.append(entry)
# Keep the parsed address rather than the raw fragment. IPv4Address
# accepts only canonical dotted-decimal (no leading zeros), so the text
# is the same, but only a validated group can reach ``bind``: CodeQL
# (py/bind-socket-all-network-interfaces) traced the blank that
# ``_clean_env_fragment`` returns through ``entry`` (SPEC CQ1).
group = str(address)
if group not in groups:
groups.append(group)
return tuple(groups) or DEFAULT_MESH_UDP_GROUPS