mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Merge commit 'c36db57acedf0033c090748125c665a0360cd11f' into glitch-soc/merge-upstream
This commit is contained in:
@@ -17,12 +17,6 @@ if ENV['REDIS_NAMESPACE']
|
||||
abort message # rubocop:disable Rails/Exit
|
||||
end
|
||||
|
||||
if ENV['MASTODON_USE_LIBVIPS'] == 'false'
|
||||
warn <<~MESSAGE
|
||||
WARNING: Mastodon support for ImageMagick is deprecated and will be removed in future versions. Please consider using libvips instead.
|
||||
MESSAGE
|
||||
end
|
||||
|
||||
if ENV.key?('WHITELIST_MODE')
|
||||
warn(<<~MESSAGE.squish)
|
||||
WARNING: The environment variable WHITELIST_MODE has been replaced with
|
||||
|
||||
@@ -182,10 +182,3 @@ unless defined?(Seahorse)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Set our ImageMagick security policy, but allow admins to override it
|
||||
ENV['MAGICK_CONFIGURE_PATH'] = begin
|
||||
imagemagick_config_paths = ENV.fetch('MAGICK_CONFIGURE_PATH', '').split(File::PATH_SEPARATOR)
|
||||
imagemagick_config_paths << Rails.root.join('config', 'imagemagick').expand_path.to_s
|
||||
imagemagick_config_paths.join(File::PATH_SEPARATOR)
|
||||
end
|
||||
|
||||
@@ -1,35 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
if Rails.configuration.x.use_vips
|
||||
ENV['VIPS_BLOCK_UNTRUSTED'] = 'true'
|
||||
ENV['VIPS_BLOCK_UNTRUSTED'] = 'true'
|
||||
|
||||
require 'vips'
|
||||
require 'vips'
|
||||
|
||||
unless Vips.at_least_libvips?(8, 13)
|
||||
abort <<~ERROR.squish # rubocop:disable Rails/Exit
|
||||
Incompatible libvips version (#{Vips.version_string}), please install libvips >= 8.13
|
||||
ERROR
|
||||
end
|
||||
|
||||
Vips.block('VipsForeign', true)
|
||||
|
||||
%w(
|
||||
VipsForeignLoadNsgif
|
||||
VipsForeignLoadJpeg
|
||||
VipsForeignLoadPng
|
||||
VipsForeignLoadWebp
|
||||
VipsForeignLoadHeif
|
||||
VipsForeignSavePng
|
||||
VipsForeignSaveSpng
|
||||
VipsForeignSaveJpeg
|
||||
VipsForeignSaveWebp
|
||||
).each do |operation|
|
||||
Vips.block(operation, false)
|
||||
end
|
||||
|
||||
Vips.block_untrusted(true)
|
||||
unless Vips.at_least_libvips?(8, 13)
|
||||
abort <<~ERROR.squish # rubocop:disable Rails/Exit
|
||||
Incompatible libvips version (#{Vips.version_string}), please install libvips >= 8.13
|
||||
ERROR
|
||||
end
|
||||
|
||||
Vips.block('VipsForeign', true)
|
||||
|
||||
%w(
|
||||
VipsForeignLoadNsgif
|
||||
VipsForeignLoadJpeg
|
||||
VipsForeignLoadPng
|
||||
VipsForeignLoadWebp
|
||||
VipsForeignLoadHeif
|
||||
VipsForeignSavePng
|
||||
VipsForeignSaveSpng
|
||||
VipsForeignSaveJpeg
|
||||
VipsForeignSaveWebp
|
||||
).each do |operation|
|
||||
Vips.block(operation, false)
|
||||
end
|
||||
|
||||
Vips.block_untrusted(true)
|
||||
|
||||
# In some places of the code, we rescue this exception, but we don't always
|
||||
# load libvips, so it may be an undefined constant:
|
||||
unless defined?(Vips)
|
||||
|
||||
Reference in New Issue
Block a user