Commit 6eb8f2b
committed
Extract _chroot_argv helper and harden user/file ops
Address svartkanin's review on #4473: factor the
['arch-chroot', '-S', str(self.target), ...] boilerplate into a
private Installer._chroot_argv() helper, and migrate the seven
existing argv-form call sites to it (useradd, gpasswd, chpasswd,
chsh, chown, snapper-create-config, grub-install).
Two related hardening tweaks while in the area:
- Raise gpasswd failure log from debug() to warn(). The group-add
loop has no return-False feedback channel for the caller, so a
silent debug() means a half-configured user looks like a
successful install.
- Add `--` end-of-options separator for useradd and chown so a
username or path starting with `-` cannot smuggle flags. The TUI
validates usernames, but parse_arguments() in models/users.py
does not, so config.json is the residual hole; this closes it
for these two sites at zero cost.1 parent 53b9be2 commit 6eb8f2b
1 file changed
Lines changed: 12 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
739 | 739 | | |
740 | 740 | | |
741 | 741 | | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
742 | 745 | | |
743 | 746 | | |
744 | 747 | | |
| |||
987 | 990 | | |
988 | 991 | | |
989 | 992 | | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
998 | | - | |
999 | | - | |
1000 | | - | |
| 993 | + | |
1001 | 994 | | |
1002 | 995 | | |
1003 | 996 | | |
| |||
1336 | 1329 | | |
1337 | 1330 | | |
1338 | 1331 | | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
| 1332 | + | |
1346 | 1333 | | |
1347 | 1334 | | |
1348 | 1335 | | |
| |||
1922 | 1909 | | |
1923 | 1910 | | |
1924 | 1911 | | |
1925 | | - | |
| 1912 | + | |
1926 | 1913 | | |
1927 | 1914 | | |
1928 | 1915 | | |
1929 | 1916 | | |
1930 | | - | |
| 1917 | + | |
1931 | 1918 | | |
1932 | 1919 | | |
1933 | 1920 | | |
| |||
1943 | 1930 | | |
1944 | 1931 | | |
1945 | 1932 | | |
1946 | | - | |
| 1933 | + | |
1947 | 1934 | | |
1948 | 1935 | | |
1949 | 1936 | | |
1950 | | - | |
| 1937 | + | |
1951 | 1938 | | |
1952 | 1939 | | |
1953 | 1940 | | |
| |||
1962 | 1949 | | |
1963 | 1950 | | |
1964 | 1951 | | |
1965 | | - | |
| 1952 | + | |
1966 | 1953 | | |
1967 | 1954 | | |
1968 | 1955 | | |
| |||
1974 | 1961 | | |
1975 | 1962 | | |
1976 | 1963 | | |
1977 | | - | |
| 1964 | + | |
1978 | 1965 | | |
1979 | 1966 | | |
1980 | 1967 | | |
| |||
1984 | 1971 | | |
1985 | 1972 | | |
1986 | 1973 | | |
1987 | | - | |
| 1974 | + | |
1988 | 1975 | | |
1989 | 1976 | | |
1990 | 1977 | | |
| |||
0 commit comments