Helper/Nix: constructRunCommandLogPath: verify uuid is valid
This shouldn't be possible normally, but it is possible to: $db->resultset('RunCommandLogs')->new({ uuid => "../etc/passwd" }); if you have access to the `$db`.
This commit is contained in:
@ -537,8 +537,10 @@ sub runcommandlog :Local :Args(1) {
|
||||
|
||||
die if defined $tail && $tail !~ /^[0-9]+$/;
|
||||
|
||||
my $runlog = $c->model('DB')->resultset('RunCommandLogs')->find({ uuid => $uuid });
|
||||
my $logFile = constructRunCommandLogPath($runlog) or notFound($c, "RunCommandLog not found.");
|
||||
my $runlog = $c->model('DB')->resultset('RunCommandLogs')->find({ uuid => $uuid })
|
||||
or notFound($c, "The RunCommand log is not available.");
|
||||
|
||||
my $logFile = constructRunCommandLogPath($runlog);
|
||||
if (-f $logFile) {
|
||||
serveLogFile($c, $logFile, $tail);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user