0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/plugins/discourse-ai/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
..
ai_bot FEATURE: flag_post tool and triage integration (#36942) 2026-01-05 10:56:15 -03:00
ai_helper FEATURE: add image generation tools (#35946) 2025-11-18 07:47:49 -08:00
ai_moderation FIX: Skip AI spam scanning for posts approved from review queue (#37263) 2026-01-23 10:15:02 +08:00
ai_tool_scripts FEATURE: triage using tool directly (#37136) 2026-01-16 09:41:30 +11:00
automation SECURITY: escape LLM triage output in review flag reasons 2026-03-19 15:46:24 +00:00
completions FEATURE: richer API for working with custom tools (#37050) 2026-01-12 18:49:38 +11:00
configuration DEV: migrate enabled_chat_bot column to a setting (#36707) 2025-12-17 09:26:19 -08:00
database DEV: Clean up scope resolution operators in plugins (#34979) 2025-09-30 14:36:34 +02:00
discord/bot FIX: Discord Bot crash due to missing BotContext in PersonaReplier (#36429) 2025-12-04 09:25:43 +01:00
discover FEATURE: Promote Discover to a dedicated feature. (#34846) 2025-09-23 14:01:45 -03:00
embeddings FIX: correct semantic related age penalty (#36327) 2025-11-29 17:13:42 +11:00
inference DEV: Make persona image tools platform agnostic (#36195) 2025-11-26 09:36:24 -08:00
inferred_concepts FIX: Ensure AI default LLM model fallback is present (#35549) 2025-10-22 09:03:29 -07:00
personas SECURITY: escape LLM triage output in review flag reasons 2026-03-19 15:46:24 +00:00
sentiment
summarization SECURITY: Force regeneration for edit-outdated summaries and block stale fallback [backport 2026.1] 2026-03-31 15:12:50 +01:00
tasks DEV: Remove old Discourse AI rake tasks (#36384) 2025-12-02 14:34:08 -03:00
translation FEATURE: Allow bot content to be AI translated (#37291) 2026-01-23 23:19:26 +08:00
utils SECURITY: Harden imagemagick execution [backport 2026.1] 2026-06-30 16:27:06 +02:00
ai_bot.rb FIX: Ensure regeneration always uses the correct llm (#36585) 2025-12-10 16:23:47 +11:00
automation.rb FEATURE: triage using tool directly (#37136) 2026-01-16 09:41:30 +11:00
embeddings.rb
engine.rb DEV: Clean up scope resolution operators in plugins (#34979) 2025-09-30 14:36:34 +02:00
guardian_extensions.rb SECURITY: Force regeneration for edit-outdated summaries and block stale fallback [backport 2026.1] 2026-03-31 15:12:50 +01:00
multisite_hash.rb
post_extensions.rb
summarization.rb PERF: Cache LlmModel lookups in backfill jobs (#36359) 2025-12-01 17:04:25 -03:00
topic_extensions.rb
translation.rb FIX: Also automatically translate to site's default locale (#37292) 2026-01-24 00:08:34 +08:00