mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 21:25:24 +08:00
SECURITY: limit amount of links in custom sidebar section (#22543)
Custom sidebar section can have maximum of 50 links Co-authored-by: Krzysztof Kotlarek <kotlarek.krzysztof@gmail.com>
This commit is contained in:
@ -29,6 +29,8 @@ class SidebarSectionsController < ApplicationController
|
||||
render_serialized(sidebar_section, SidebarSectionSerializer)
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
render_json_error(e.record.errors.full_messages.first)
|
||||
rescue ActiveRecord::NestedAttributes::TooManyRecords => e
|
||||
render_json_error(e.message)
|
||||
end
|
||||
|
||||
def update
|
||||
@ -62,6 +64,8 @@ class SidebarSectionsController < ApplicationController
|
||||
render_serialized(sidebar_section.reload, SidebarSectionSerializer)
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
render_json_error(e.record.errors.full_messages.first)
|
||||
rescue ActiveRecord::NestedAttributes::TooManyRecords => e
|
||||
render_json_error(e.message)
|
||||
rescue Discourse::InvalidAccess
|
||||
render json: failed_json, status: 403
|
||||
end
|
||||
|
Reference in New Issue
Block a user