@@ -4,7 +4,6 @@ module fortplot_imagemagick
44
55 use , intrinsic :: iso_fortran_env, only: wp = > real64, int32
66 use fortplot_system_runtime, only: check_command_available_runtime
7- use fortplot_security, only: is_imagemagick_environment_enabled
87 implicit none
98 private
109
@@ -19,14 +18,8 @@ module fortplot_imagemagick
1918 function check_imagemagick_available () result(available)
2019 ! ! Check if ImageMagick is available on the system
2120 logical :: available
22-
23- ! First check if ImageMagick is enabled in secure environment
24- if (is_imagemagick_environment_enabled()) then
25- available = .true.
26- return
27- end if
28-
29- ! Otherwise check if commands are available (legacy path)
21+
22+ ! Check if ImageMagick commands are available
3023 call check_command_available_runtime(" magick" , available)
3124
3225 if (.not. available) then
@@ -59,17 +52,7 @@ function compare_images_rmse(image1, image2) result(rmse)
5952 ' " /dev/null 2> "' // trim (output_file) // ' "'
6053#endif
6154
62- ! Check if ImageMagick is enabled in secure environment
63- if (.not. is_imagemagick_environment_enabled()) then
64- ! SECURITY: ImageMagick comparison requires external tool execution
65- ! This functionality is disabled for security compliance
66- rmse = - 1.0_wp
67- return
68- end if
69-
70- ! SECURITY FIX: ImageMagick operations are blocked in secure mode
71- ! The is_imagemagick_environment_enabled check above prevents execution
72- ! This code path should never be reached, but we'll fail safely
55+ ! ImageMagick not available - return error
7356 rmse = - 1.0_wp
7457 return
7558
@@ -128,17 +111,7 @@ function compare_images_psnr(image1, image2) result(psnr)
128111 ' " /dev/null 2> "' // trim (output_file) // ' "'
129112#endif
130113
131- ! Check if ImageMagick is enabled in secure environment
132- if (.not. is_imagemagick_environment_enabled()) then
133- ! SECURITY: ImageMagick comparison requires external tool execution
134- ! This functionality is disabled for security compliance
135- psnr = - 1.0_wp
136- return
137- end if
138-
139- ! SECURITY FIX: ImageMagick operations are blocked in secure mode
140- ! The is_imagemagick_environment_enabled check above prevents execution
141- ! This code path should never be reached, but we'll fail safely
114+ ! ImageMagick not available - return error
142115 psnr = - 1.0_wp
143116 return
144117
@@ -201,18 +174,8 @@ subroutine generate_reference_image(filename, width, height)
201174 trim (adjustl (int_to_str(height-10 ))) // ' " ' // &
202175 ' -blur 0x0.5 "' // trim (filename) // ' "'
203176
204- ! Check if ImageMagick is enabled in secure environment
205- if (.not. is_imagemagick_environment_enabled()) then
206- ! SECURITY: ImageMagick image generation requires external tool execution
207- ! This functionality is disabled for security compliance
208- print * , " WARNING: ImageMagick image generation disabled for security"
209- return
210- end if
211-
212- ! SECURITY FIX: ImageMagick operations are blocked in secure mode
213- ! The is_imagemagick_environment_enabled check above prevents execution
214- ! This code path should never be reached, but we'll fail safely
215- print * , " WARNING: ImageMagick image generation blocked for security"
177+ ! ImageMagick not available
178+ print * , " WARNING: ImageMagick not available"
216179 return
217180
218181 if (.false. ) then
@@ -232,11 +195,7 @@ function analyze_edge_smoothness(image_file) result(smoothness_score)
232195 logical :: file_exists
233196 real (wp) :: mean_edge
234197
235- ! Check if ImageMagick is enabled in secure environment
236- if (.not. is_imagemagick_environment_enabled()) then
237- ! SECURITY: ImageMagick edge analysis requires external tool execution
238- ! This functionality is disabled for security compliance
239- ! Return error code to indicate disabled functionality
198+ ! ImageMagick not available - return error
240199 smoothness_score = - 1.0_wp
241200 return
242201 end if
@@ -249,11 +208,6 @@ function analyze_edge_smoothness(image_file) result(smoothness_score)
249208 ' magick "' // trim (image_file) // ' " -edge 1 -format "%[fx:mean*100]" info: > "' // &
250209 trim (output_file) // ' "'
251210
252- ! SECURITY FIX: ImageMagick operations are blocked in secure mode
253- ! The is_imagemagick_environment_enabled check above prevents execution
254- ! This code path should never be reached, but we'll fail safely
255- smoothness_score = - 1.0_wp
256- return
257211
258212 if (.false. ) then
259213 ! Read the result from file
0 commit comments