Helper/Nix: constructRunCommandLogPath: take RunCommandLog as input

This way we ensure that it actually exists in the database, rather than
blindly trusting user-generated input.
This commit is contained in:
Cole Helbling
2022-01-28 10:02:31 -08:00
parent 61914d56c6
commit 8eab7b8543
4 changed files with 8 additions and 6 deletions

View File

@ -537,7 +537,8 @@ sub runcommandlog :Local :Args(1) {
die if defined $tail && $tail !~ /^[0-9]+$/;
my $logFile = constructRunCommandLogPath($uuid);
my $runlog = $c->model('DB')->resultset('RunCommandLogs')->find({ uuid => $uuid });
my $logFile = constructRunCommandLogPath($runlog);
if (-f $logFile) {
serveLogFile($c, $logFile, $tail);
return;