fix vulnerabilities
This commit is contained in:
@@ -2,7 +2,7 @@ class EntriesController < ApplicationController
|
||||
before_action :set_entry, only: [ :show, :edit, :update ]
|
||||
|
||||
def index
|
||||
@language_code = params[:language].presence
|
||||
@language_code = validate_language_code(params[:language].presence)
|
||||
@category = params[:category].presence
|
||||
@query = params[:q].to_s.strip
|
||||
@starts_with = params[:starts_with].presence
|
||||
@@ -79,4 +79,10 @@ class EntriesController < ApplicationController
|
||||
def entry_params
|
||||
params.require(:entry).permit(:category)
|
||||
end
|
||||
|
||||
def validate_language_code(code)
|
||||
return nil if code.blank?
|
||||
|
||||
SupportedLanguage.valid_codes.include?(code) ? code : nil
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user