From c74af93eeea1beb969dc9fd1ccc112d6334b80de Mon Sep 17 00:00:00 2001 From: rulingcom Date: Sat, 24 Oct 2026 13:17:15 +0800 Subject: [PATCH] Escape user input before building regexps --- app/controllers/curation_posts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/curation_posts_controller.rb b/app/controllers/curation_posts_controller.rb index 67a0104..44125c2 100644 --- a/app/controllers/curation_posts_controller.rb +++ b/app/controllers/curation_posts_controller.rb @@ -39,7 +39,7 @@ class CurationPostsController < ApplicationController if !params[:category].blank? module_id = ModuleApp.where(:key=>"curation").first.id - category = Regexp.new(".*"+params[:category]+".*") + category = Regexp.new(".*"+Regexp.escape(params[:category].to_s)+".*") category_id = Category.where(:title => category, :module_app_id => module_id).first.id bulletins = bulletins.where(:category_id => category_id) else