We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3014bc3 + fff54d9 commit 6a7b588Copy full SHA for 6a7b588
apps/dashboard/app/controllers/files_controller.rb
@@ -67,8 +67,13 @@ def fs
67
next unless File.readable?(file.realpath)
68
69
if File.file?(file.realpath)
70
- zip.write_deflated_file(file.relative_path.to_s) do |zip_file|
71
- IO.copy_stream(file.realpath, zip_file)
+ File.open(file.realpath, 'rb') do |opened_file|
+ real_path = File.readlink("/proc/self/fd/#{opened_file.fileno}")
72
+ next unless AllowlistPolicy.default.permitted?(real_path)
73
+
74
+ zip.write_deflated_file(file.relative_path.to_s) do |zip_file|
75
+ IO.copy_stream(opened_file, zip_file)
76
+ end
77
end
78
else
79
zip.add_empty_directory(dirname: file.relative_path.to_s)
0 commit comments