Do more proper path validation for playlist generation
All checks were successful
Core Repos/ImageApi/pipeline/head This commit looks good

This commit is contained in:
Cameron Cordes
2021-02-08 18:38:30 -05:00
parent 659bad02c9
commit ecd43f776a

View File

@@ -199,8 +199,8 @@ async fn stream_video(
println!("Playlist: {}", playlist); println!("Playlist: {}", playlist);
// Extract video playlist dir to dotenv // Extract video playlist dir to dotenv
if !playlist.starts_with("tmp") || playlist.contains("..") { if !playlist.starts_with("tmp") && is_valid_path(playlist) != None {
HttpResponse::NotFound().finish() HttpResponse::BadRequest().finish()
} else if let Ok(file) = NamedFile::open(playlist) { } else if let Ok(file) = NamedFile::open(playlist) {
file.into_response(&request).unwrap() file.into_response(&request).unwrap()
} else { } else {