iucvterm/ts-shell: Add Perl taint tests for auditdir and getpwuid()

The audit directory ts-shell configuration and also the output of
getpwuid() are considered tainted when running in Perl taint (-T) mode.

Provide untaint checks with validating the content.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Hendrik Brueckner
2026-07-09 14:23:16 +02:00
committed by Jan Höppner
parent f216862052
commit b3dd05e16d

View File

@@ -227,6 +227,16 @@ sub checkConfiguration(\%)
exit 7;
}
$cfg->{iucvconn} = $1;
# Validate transcript-directory to untaint for later use
unless ($cfg->{auditdir} =~ m#^(/[\w./-]+)$#) {
log_error "Invalid transcript-directory configuration";
exit 8;
}
$cfg->{auditdir} = $1;
# Untaint user name (tainted by getpwuid) for use in filesystem paths
($cfg->{user}) = ($cfg->{user} =~ /^([\w.-]+)$/);
}
# loadAuthorization() - Load system authorizations from file