Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/GADS/Filecheck.pm
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ sub check_file
|application/rtf|application/vnd\.ms-excel
|application/vnd\.openxmlformats-officedocument\.spreadsheetml\.sheet
|application/json
|message/.*
)!xi;

$upload->filename =~ /\.([a-z]+)$/i
or error __"Files without extensions cannot be uploaded";
my $ext = $1;
error __x"Files with extension of {ext} are not allowed", ext => $ext
unless $ext =~ /^(doc|docx|pdf|jpeg|jpg|png|wav|rtf|xls|xlsx|ods|ppt|pptx|odf|odg|odt|ott|sda|sdc|sdd|sdw|sxc|sxw|odp|sdp|csv|txt|msg|tif|svg)$/i;
unless $ext =~ /^(doc|docx|pdf|jpeg|jpg|png|wav|rtf|xls|xlsx|ods|ppt|pptx|odf|odg|odt|ott|sda|sdc|sdd|sdw|sxc|sxw|odp|sdp|csv|txt|msg|tif|svg|eml)$/i;

# As recommended at https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload
# Brackets have been added to this - above recommendations do not explicitly state that brackets are not allowed - Ticket #1695
Expand Down
Loading