We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents ff2326c + 6d111c3 commit b2d1f2aCopy full SHA for b2d1f2a
apps/dashboard/app/controllers/files_controller.rb
@@ -68,8 +68,13 @@ def fs
68
next unless File.readable?(file.realpath)
69
70
if File.file?(file.realpath)
71
- zip.write_deflated_file(file.relative_path.to_s) do |zip_file|
72
- 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}")
73
+ next unless AllowlistPolicy.default.permitted?(real_path)
74
+
75
+ zip.write_deflated_file(file.relative_path.to_s) do |zip_file|
76
+ IO.copy_stream(opened_file, zip_file)
77
+ end
78
end
79
else
80
zip.add_empty_directory(dirname: file.relative_path.to_s)
0 commit comments