What was wrong:set_hostname() ran uci set system.@system[0].hostname='<name>' && … with the name between single quotes of its own; a name with a single quote ended them and the rest ran as root (x';reboot;'). See NetOrk/netork#2456.
Fix: the uci set is built with uci_steps.uci(), which quotes each word with shlex.join.
Tests:tests/unit/test_set_hostname.py — the name, including x';reboot;', $(reboot) and a space, reaches uci as one word, and nothing else runs (red before the fix for the quote).
**What was wrong:** `set_hostname()` ran `uci set system.@system[0].hostname='<name>' && …` with the name between single quotes of its own; a name with a single quote ended them and the rest ran as root (`x';reboot;'`). See NetOrk/netork#2456.
**Fix:** the `uci set` is built with `uci_steps.uci()`, which quotes each word with `shlex.join`.
**Tests:** `tests/unit/test_set_hostname.py` — the name, including `x';reboot;'`, `$(reboot)` and a space, reaches `uci` as one word, and nothing else runs (red before the fix for the quote).
Closes #43
The name stood between single quotes of its own in
`uci set system.@system[0].hostname='<name>'`, so a name with a single
quote ended them and the rest ran as root (NetOrk/netork#2456). The
command is now built with uci_steps.uci(), which quotes each word with
shlex.
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 was wrong:
set_hostname()ranuci set system.@system[0].hostname='<name>' && …with the name between single quotes of its own; a name with a single quote ended them and the rest ran as root (x';reboot;'). See NetOrk/netork#2456.Fix: the
uci setis built withuci_steps.uci(), which quotes each word withshlex.join.Tests:
tests/unit/test_set_hostname.py— the name, includingx';reboot;',$(reboot)and a space, reachesucias one word, and nothing else runs (red before the fix for the quote).Closes #43