What happens:napalm_bsd/base.py::_action_fix_snmp (around lines 418–434) runs its config step as mkdir -p … && cat > {SNMPD_CONF} && chmod 644 {SNMPD_CONF} with privileged=True, stdin=_SNMPD_CONF.
napalm-bsd's own run_command (base.py:150-161) puts the sudo password in front of stdin for sudo -S. When sudo does not prompt (NOPASSWD, or a cached timestamp), it leaves the password line on stdin, and cat writes it as line 1 of a world-readable snmpd.conf.
This is the same bug as NetOrk/netork#1029 (seen for real on 2026-10-11 with the SSH fix). The napalm-linux guard from #1029 does not cover napalm-bsd, because its run_command is its own implementation, not a LinuxDriver subclass.
Fix:
Stage the config without privilege (umask 077; mktemp; cat), then have root run install -m 644 <staged> <SNMPD_CONF>; rm <staged>. This is the pattern of napalm-device-types ssh_server.py::_ssh_write.
Add the same guard to run_command: refuse privileged=True together with stdin while a sudo password is set.
tests/test_drivers.py:486: its fake does not prepend a password to privileged stdin, so the test cannot see this. Make the fake model it.
**What happens:** `napalm_bsd/base.py::_action_fix_snmp` (around lines 418–434) runs its config step as
`mkdir -p … && cat > {SNMPD_CONF} && chmod 644 {SNMPD_CONF}` with `privileged=True, stdin=_SNMPD_CONF`.
napalm-bsd's own `run_command` (`base.py:150-161`) puts the sudo password in front of stdin for `sudo -S`. When sudo does not prompt (NOPASSWD, or a cached timestamp), it leaves the password line on stdin, and `cat` writes it as line 1 of a world-readable `snmpd.conf`.
This is the same bug as NetOrk/netork#1029 (seen for real on 2026-10-11 with the SSH fix). The napalm-linux guard from #1029 does not cover napalm-bsd, because its `run_command` is its own implementation, not a LinuxDriver subclass.
**Fix:**
- Stage the config without privilege (`umask 077; mktemp; cat`), then have root run `install -m 644 <staged> <SNMPD_CONF>; rm <staged>`. This is the pattern of napalm-device-types `ssh_server.py::_ssh_write`.
- Add the same guard to `run_command`: refuse `privileged=True` together with `stdin` while a sudo password is set.
- `tests/test_drivers.py:486`: its fake does not prepend a password to privileged stdin, so the test cannot see this. Make the fake model it.
Prio: P2 (credential leak). Found while working on NetOrk/netork#1029.
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:
napalm_bsd/base.py::_action_fix_snmp(around lines 418–434) runs its config step asmkdir -p … && cat > {SNMPD_CONF} && chmod 644 {SNMPD_CONF}withprivileged=True, stdin=_SNMPD_CONF.napalm-bsd's own
run_command(base.py:150-161) puts the sudo password in front of stdin forsudo -S. When sudo does not prompt (NOPASSWD, or a cached timestamp), it leaves the password line on stdin, andcatwrites it as line 1 of a world-readablesnmpd.conf.This is the same bug as NetOrk/netork#1029 (seen for real on 2026-10-11 with the SSH fix). The napalm-linux guard from #1029 does not cover napalm-bsd, because its
run_commandis its own implementation, not a LinuxDriver subclass.Fix:
umask 077; mktemp; cat), then have root runinstall -m 644 <staged> <SNMPD_CONF>; rm <staged>. This is the pattern of napalm-device-typesssh_server.py::_ssh_write.run_command: refuseprivileged=Truetogether withstdinwhile a sudo password is set.tests/test_drivers.py:486: its fake does not prepend a password to privileged stdin, so the test cannot see this. Make the fake model it.Prio: P2 (credential leak). Found while working on NetOrk/netork#1029.