Skip to content

Commit

Permalink
SQLインジェクションにより、情報を不正取得できてしまう不具合を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nacl-anno committed Oct 7, 2015
1 parent c0c0f83 commit 5ec03cb
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
11 changes: 11 additions & 0 deletions pref-shimane-cms/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

## Version 2.0.1 (2015/10/7)

* Bugfix

* SQLインジェクションにより、情報を不正取得できてしまう不具合を修正

## Version 2.0.0 (2014/9/6)

* 初期リリース
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ def initialize(attr = {})
super
end


#
#=== 検索を実施する
#
Expand All @@ -278,7 +277,43 @@ def last_modified_sortable?
false
end
end

#
#=== ソート順を返す
#
def order_by
order_option = ''
if valid_order_params?
direction = self.order_direction || 'ASC'
order_option = "#{self.order_column} #{direction}"
end
order_option.present? ? order_option : @@default_order
end

#
#=== ソートパラメータを検証する
#
def valid_order_params?
if self.order_column.blank?
return false
end

permit_column_params = ['pages.name', 'page_contents.last_modified']
permit_dir_params = ['ASC', 'DESC']

unless permit_column_params.include?(self.order_column)
return false
end

if self.order_direction.present? &&
!permit_dir_params.include?(self.order_direction.upcase)
return false
end

return true
end
end

end
end

2 changes: 1 addition & 1 deletion pref-shimane-cms/config/initializers/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module PrefShimaneCms
class Application
VERSION = '2.0.0'
VERSION = '2.0.1'
end
end

0 comments on commit 5ec03cb

Please sign in to comment.