Skip to content

Commit b43450c

Browse files
committed
fix(ports): silence bandit B104 false-positive on parser wildcard match
`ss -tulnpH` reports wildcard-bind addresses as either "*" or "0.0.0.0"; the parser checks for those strings and normalises them to None so PortOwner.address stays informational-only. We're matching parser output, not binding a socket — but bandit's B104 check fires on the string literal and CI's `bandit -r src/shimkit -ll` is fail-on-medium+. # nosec with a reason at the site.
1 parent 6cf38f4 commit b43450c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/shimkit/tools/ports/owners.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ def _split_addr_port(local: str) -> tuple[str | None, int | None]:
174174
if idx < 0:
175175
return None, None
176176
addr = local[:idx] or None
177-
if addr in ("*", "0.0.0.0"):
177+
# Normalise wildcard-bind addresses from `ss` output to None so the
178+
# PortOwner.address is informational only. We're parsing, not binding.
179+
if addr in ("*", "0.0.0.0"): # nosec B104 — string match on parser output, not a bind
178180
addr = None
179181
try:
180182
port = int(local[idx + 1 :])

0 commit comments

Comments
 (0)