do not munge hash keys in client-provided request. fixes #1516
authorTom Clegg <tom@clinicalfuture.com>
Tue, 24 Sep 2013 17:30:20 +0000 (13:30 -0400)
committerTom Clegg <tom@clinicalfuture.com>
Tue, 24 Sep 2013 17:31:47 +0000 (13:31 -0400)
services/api/app/controllers/application_controller.rb
services/api/app/controllers/static_controller.rb
services/api/app/controllers/user_sessions_controller.rb

index 0a89e21021769cb708c4c6977f42737acf369b6a..d9d7ad864d8641aa621ae5a2c521728072dd924e 100644 (file)
@@ -2,7 +2,6 @@ class ApplicationController < ActionController::Base
   include CurrentApiClient
 
   protect_from_forgery
-  before_filter :uncamelcase_params_hash_keys
   around_filter :thread_with_auth_info, :except => [:render_error, :render_not_found]
 
   before_filter :remote_ip
@@ -189,7 +188,7 @@ class ApplicationController < ActionController::Base
     return @attrs if @attrs
     @attrs = params[resource_name]
     if @attrs.is_a? String
-      @attrs = uncamelcase_hash_keys(Oj.load @attrs)
+      @attrs = Oj.load @attrs
     end
     unless @attrs.is_a? Hash
       message = "No #{resource_name}"
@@ -323,27 +322,6 @@ class ApplicationController < ActionController::Base
     end
   end
 
-  def uncamelcase_params_hash_keys
-    self.params = uncamelcase_hash_keys(params)
-  end
-  def uncamelcase_hash_keys(h, max_depth=-1)
-    if h.is_a? Hash and max_depth != 0
-      nh = Hash.new
-      h.each do |k,v|
-        if k.class == String
-          nk = k.underscore
-        elsif k.class == Symbol
-          nk = k.to_s.underscore.to_sym
-        else
-          nk = k
-        end
-        nh[nk] = uncamelcase_hash_keys(v, max_depth-1)
-      end
-      h.replace(nh)
-    end
-    h
-  end
-
   def render_list
     @object_list = {
       :kind  => "arvados##{resource_name}List",
index 533f6557e60ac365876066a9cb47a1e7ca02e0de..071425212a761a2bc11dfefc936900a0b58f7e95 100644 (file)
@@ -1,6 +1,5 @@
 class StaticController < ApplicationController
 
-  skip_before_filter :uncamelcase_params_hash_keys
   skip_before_filter :find_object_by_uuid
   skip_before_filter :require_auth_scope_all, :only => :home
 
index 2c22cb893284b9e985b97321a45c6ab2e04ef3d3..612061eb6f43ff3101f0bcc4f8bb77fee30f4ceb 100644 (file)
@@ -1,7 +1,6 @@
 class UserSessionsController < ApplicationController
   before_filter :require_auth_scope_all, :only => [ :destroy ]
 
-  skip_before_filter :uncamelcase_params_hash_keys
   skip_before_filter :find_object_by_uuid
 
   respond_to :html