You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.
otherwise on exeptions the rails log has too much spam.
add delete(:controller) to the two rescues...
moduleHyperloopclassServerOp < Operationclass << selfdefrun_from_client(security_param,controller,operation,params)ifRails.env.production?# in production everything is eager loaded so ServerOp.descendants is filled and can be used to guard the .constantizeHyperloop::InternalPolicy.raise_operation_access_violationunlessHyperloop::ServerOp.descendants_map_cache.include?(operation)# however ...else# ... in development things are autoloaded on demand, thus ServerOp.descendants can be empty or partially filled and above guard# would fail legal operations. To prevent this, the class has to be loaded first, what .const_get will take care of, and then# its guarded, to achieve similar behaviour as in production. Doing the const_get first, before the guard,# would not be safe for production and allow for potential remote code execution!beginconst=Object.const_get(operation)rescueNameErrorHyperloop::InternalPolicy.raise_operation_access_violationendHyperloop::InternalPolicy.raise_operation_access_violationunlessconst < Hyperloop::ServerOpendoperation.constantize.class_evaldoif_Railway.params_wrapper.method_defined?(:controller)params[:controller]=controllerelsif !_Railway.params_wrapper.method_defined?(security_param)raiseAccessViolationendrun(deserialize_params(params)).then{ |r| return{json: {response: serialize_response(r)}}}.faildo |e|
params.delete(:controller)# <-------------------------------------------------------
::Rails.logger.debug"\033[0;31;1mERROR: Hyperloop::ServerOp failed when running #{operation} with params \"#{params}\": #{e}\033[0;30;21m"return{json: {error: e},status: 500}endendrescueException=>eparams.delete(:controller)# <-------------------------------------------------------
::Rails.logger.debug"\033[0;31;1mERROR: Hyperloop::ServerOp exception caught when running #{operation} with params \"#{params}\": #{e}\033[0;30;21m"{json: {error: e},status: 500}end
The text was updated successfully, but these errors were encountered:
otherwise on exeptions the rails log has too much spam.
add delete(:controller) to the two rescues...
The text was updated successfully, but these errors were encountered: