[client] Reject leading hyphen in getent input to prevent flag injection (#6787)

This commit is contained in:
Viktor Liu
2026-07-17 09:28:33 +02:00
committed by GitHub
parent 62fc8d254e
commit 63d60ba490
2 changed files with 9 additions and 1 deletions
+3
View File
@@ -157,6 +157,9 @@ func TestValidateGetentInput(t *testing.T) {
{"numeric UID", "1001", true},
{"dots and underscores", "alice.bob_test", true},
{"hyphen", "alice-bob", true},
{"leading hyphen rejected", "-i", false},
{"leading double hyphen rejected", "--no-idn", false},
{"lone hyphen rejected", "-", false},
{"kerberos principal", "user@REALM", true},
{"samba machine account", "MACHINE$", true},
{"NIS compat", "+user", true},