Skip to content

Commit

Permalink
Limit allowed SEO settings params
Browse files Browse the repository at this point in the history
This limits the set of parameters in the Admin::SeoController to the set
of valid blog settings, similar to AdminSettingsController. In addition,
it allows the extra :custom_permalink key to facilitate the options plus
text field construction in the SEO settings form. This eliminates the
use of the unsafe #permit! method.
  • Loading branch information
mvz committed Oct 13, 2024
1 parent 21f3f86 commit f6ac3db
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/admin/seo_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def update
private

def settings_params
@settings_params ||= params.require(:setting).permit!
@settings_params ||= params.require(:setting).permit(settings_keys)
end

def settings_keys
@setting.settings_keys + [:custom_permalink]
end

VALID_SECTIONS = %w(general titles permalinks).freeze
Expand Down

0 comments on commit f6ac3db

Please sign in to comment.