The optimizer endpoint re-implements sanitization and drops the configured settings
Description
safe_svg_optimize builds its own Sanitizer and checks neither the plugin's SVG upload-role setting, the remote-reference filter, nor the target attachment's type. This means if optimization is turned on, the settings that fire when normal sanitization fire won't necessarily fire for optimization, potentially allowing users to upload SVGs that shouldn't or upload larger than expected files.
This has been resolved in Safe SVG 2.5.2 by ensuring the optimizer uses the same Svg_Sanitizer class used elsewhere.