Address function_clause error
lukebakken opened this issue · 4 comments
https://pivotal-esc.atlassian.net/browse/VESC-974
A user's valid vhosts can't be established due to a swallowed function_clause error in this plugin. Stack trace:
{'EXIT',{function_clause,[{rabbit_auth_backend_http,check_vhost_access,[{auth_user,<<"lbakken">>,[management],none},<<"VESC974">>,undefined],[{file,"src/rabbit_auth_backend_http.erl"},{line,62}]},{rabbit_access_control,check_access,5,[{file,"src/rabbit_access_control.erl"},{line,221}]},{lists,foldl,3,[{file,"lists.erl"},{line,1263}]},{rabbit_mgmt_util,'-list_login_vhosts_names/2-lc$^2/1-0-',3,[{file,"src/rabbit_mgmt_util.erl"},{line,1092}]},{rabbit_mgmt_wm_vhosts,to_json,2,[{file,"src/rabbit_mgmt_wm_vhosts.erl"},{line,44}]},{cowboy_rest,call,3,[{file,"src/cowboy_rest.erl"},{line,1576}]},{cowboy_rest,set_resp_body,2,[{file,"src/cowboy_rest.erl"},{line,1466}]},{cowboy_rest,upgrade,4,[{file,"src/cowboy_rest.erl"},{line,288}]}]}}
Introduced by this commit -
This must be a very unique combination of using this plugin and having multiple vhosts, only a subset of which a user has access to. Otherwise I would expect it to have been reported by now.
@michaelklishin I admit I'm a bit surprised to see we catch from check_vhost_access but not other access control methods. I figure the safe option at this point is to log the value but crashing is also an option. What do you think? In addition, there is one place (rabbit_reader I think) where check_vhost_access is not caught. Hmm.
I'd log the value and keep the catch clause.
OK that's what I have done, thanks.
@michaelklishin thank you for the reviews.