0
Customer.find(:all, :select => 'id', :order => 'updated_at DESC', :readonly => true, :conditions => { :status_id => Customer.id_for_status(params[:id].to_sym) }, :offset => offset, :limit => 30).collect(&:id)
拒絕以上是我在該查詢我收到警告像獲取警告:服務
Symbol conversion from unsafe string (parameter value) near line 33: params[:id].to_sym
這是拒絕服務攻擊的警告。任何人有任何想法如何解決這個警告?
在此先感謝
方法'id_for_status'可以更改爲接受字符串而不是符號? – Baldrick
只是一個受過教育的猜測:嘗試截斷一些合理的最大長度:'params [:id] [0 ... 20] .to_sym'。我的猜測是鐵軌試圖保護你免於使用大量的符號實習空間(一旦使用符號,持有它的人物的空間永遠不會被釋放)。如果這不起作用,則必須在符號轉換之前驗證參數。 – Gene
謝謝@Baldrick,這是有效的 –