aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/run-test.sh
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-11 18:32:19 -0500
committerCraig Jennings <c@cjennings.net>2026-05-11 18:32:19 -0500
commit1ff51146d9de6ed76e67945fea9f9ca61acdda00 (patch)
tree45dc80733c69c4d0486f4a9763dd6c4ed851c96a /scripts/testing/run-test.sh
parent24e3c8497c69011ae5f4e35c35deac4996b45d2c (diff)
downloadarchsetup-1ff51146d9de6ed76e67945fea9f9ca61acdda00.tar.gz
archsetup-1ff51146d9de6ed76e67945fea9f9ca61acdda00.zip
feat(archsetup): add input validation for config and username
A new `validate_config()` runs whenever `--config-file` is used and rejects bad values up front instead of letting the install run partway and die: `DESKTOP_ENV` must be dwm/hyprland/none (previously only caught in the display-server step), `AUTOLOGIN`/`NO_GPU_DRIVERS` must be yes/no (previously silently ignored), `LOCALE` gets a basic shape check, and the six `*_REPO` URLs get a scheme plus no-whitespace/no-leading-dash check before they reach `git clone`. I also pulled the username regex and reserved-names check out of `preflight_checks()` into a `validate_username()` helper, and call it from both `preflight_checks()` and `validate_config()`. That closes a gap: the old inline check only ran when the username was prompted, so a config-supplied `USERNAME=root` went through unchecked. This is not a security boundary: `load_config` sources the config as bash, so a hostile config can already do anything. It is about catching typos with a clear message. Verified with `bash -n` and a smoke-test matrix. The next `make test` run confirms valid configs still install.
Diffstat (limited to 'scripts/testing/run-test.sh')
0 files changed, 0 insertions, 0 deletions