Quoting keeps a value one word, but a word that starts with - is still read by ping as an option: shlex.quote("-f") is -f, so ping(destination="-f") sends a flood ping option instead of a host, and other options (-p, -b, …) can be injected the same way. The same holds for source after -I (a value such as -f makes -I consume nothing useful).
Expected
A destination or source that starts with - is refused (ValueError) before anything is sent, or the destination follows --. Test-first: ping("-f") raises / sends -- '-f'.
Priority: P3 — option injection in a public driver method; netOrk passes only addresses from ipaddress (see #55), so not reachable from netOrk's input.
Found during the bug sweep of 2026-11-02 (review of #55).
## What happens
Since #55, `ping_command()` (`napalm_linux/_ping.py`, on PR #61) passes `destination` and `source` through `shlex.quote`:
```python
return f"ping {numbers}{src_opt} {quote(destination)} 2>&1"
```
Quoting keeps a value one word, but a word that starts with `-` is still read by `ping` as an option: `shlex.quote("-f")` is `-f`, so `ping(destination="-f")` sends a flood ping option instead of a host, and other options (`-p`, `-b`, …) can be injected the same way. The same holds for `source` after `-I` (a value such as `-f` makes `-I` consume nothing useful).
## Expected
A destination or source that starts with `-` is refused (`ValueError`) before anything is sent, or the destination follows `--`. Test-first: `ping("-f")` raises / sends `-- '-f'`.
Priority: P3 — option injection in a public driver method; netOrk passes only addresses from `ipaddress` (see #55), so not reachable from netOrk's input.
Found during the bug sweep of 2026-11-02 (review of #55).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What happens
Since #55,
ping_command()(napalm_linux/_ping.py, on PR #61) passesdestinationandsourcethroughshlex.quote:Quoting keeps a value one word, but a word that starts with
-is still read bypingas an option:shlex.quote("-f")is-f, soping(destination="-f")sends a flood ping option instead of a host, and other options (-p,-b, …) can be injected the same way. The same holds forsourceafter-I(a value such as-fmakes-Iconsume nothing useful).Expected
A destination or source that starts with
-is refused (ValueError) before anything is sent, or the destination follows--. Test-first:ping("-f")raises / sends-- '-f'.Priority: P3 — option injection in a public driver method; netOrk passes only addresses from
ipaddress(see #55), so not reachable from netOrk's input.Found during the bug sweep of 2026-11-02 (review of #55).