0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/plugins/discourse-ai/spec/lib
David Taylor 448d9fe5e1 SECURITY: Harden imagemagick execution [backport 2026.1]
Backport of #775 to release/2026.1.

---

Add a default-deny ImageMagick security policy at `config/imagemagick/policy.xml`, loaded via `MAGICK_CONFIGURE_PATH` which is set in `config/initializers/003-imagemagick.rb`. Child processes inherit the env var, so every `identify`/`magick`/`convert` we shell out to is covered, including from plugins.

Discourse previously shipped an imagemagick policy in production (see `discourse/discourse_docker` repository). This change brings the policy into the core repository to make it more visible, easier to manage, and applicable for development environments. Resource limitations remain the same. The main change is to move the allowed coders to an allowlist instead of a denylist. This ensures consistent safety, regardless of the set of modules available on the system.

`Upload#fix_dimensions!` is updated to explicitly set the `MSVG:` decoder. This is the decoder which Imagemagick was selecting previously for `-ping` calls. But now, since the `svg` coder isn't in our allowlist, we have to specify msvg explicitly.

The pdf-to-image logic in discourse-ai (behind an experimental, hidden, and default-disabled setting) is removed, since it depended on processing pdfs via Imagemagick/ghostscript.

The spec for svg rasterization via OptimizedImage is also removed. This was not used in any application code.

---

https://github.com/discourse/discourse/security/advisories/GHSA-7wq5-jgww-5rw3
2026-06-30 16:27:06 +02:00
..
automation DEV: Allow AI tagging automation to tag system-created topics (#35245) 2025-10-08 11:47:16 -04:00
completions DEV: Fix date-related ai specs [backport 2026.1] (#38244) 2026-03-04 18:12:18 +00:00
discord/bot FIX: Discord Bot crash due to missing BotContext in PersonaReplier (#36429) 2025-12-04 09:25:43 +01:00
discourse_automation FEATURE: triage using tool directly (#37136) 2026-01-16 09:41:30 +11:00
inference FEATURE: Add support for matryoshka in Gemini embeddings (#34145) 2025-08-07 15:35:08 -03:00
inferred_concepts DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073) 2025-10-06 16:11:01 +02:00
modules SECURITY: Force regeneration for edit-outdated summaries and block stale fallback [backport 2026.1] 2026-03-31 15:12:50 +01:00
personas SECURITY: escape LLM triage output in review flag reasons 2026-03-19 15:46:24 +00:00
translation FIX: Also automatically translate to site's default locale (#37292) 2026-01-24 00:08:34 +08:00
utils SECURITY: Harden imagemagick execution [backport 2026.1] 2026-06-30 16:27:06 +02:00
guardian_extensions_spec.rb SECURITY: Force regeneration for edit-outdated summaries and block stale fallback [backport 2026.1] 2026-03-31 15:12:50 +01:00